readded commissions_controller
This commit is contained in:
62
.idea/workspace.xml
generated
62
.idea/workspace.xml
generated
@@ -2,31 +2,7 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="89ca96af-a0e4-4fe4-b9a3-9969f22d7079" name="Default" comment="">
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/controllers/origami/in_juties_controller.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/helpers/origami/in_juties_helper.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/models/in_juty.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/views/origami/in_juties/_form.html.erb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/views/origami/in_juties/_in_juty.json.jbuilder" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/views/origami/in_juties/edit.html.erb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/views/origami/in_juties/index.html.erb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/views/origami/in_juties/index.json.jbuilder" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/views/origami/in_juties/new.html.erb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/views/origami/in_juties/show.html.erb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/views/origami/in_juties/show.json.jbuilder" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/db/migrate/20170823081747_create_in_juties.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/controllers/origami/in_juties_controller_spec.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/helpers/origami/in_juties_helper_spec.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/models/in_juty_spec.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/requests/origami/origami_in_juties_spec.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/routing/origami/in_juties_routing_spec.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/views/origami/in_juties/edit.html.erb_spec.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/views/origami/in_juties/index.html.erb_spec.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/views/origami/in_juties/new.html.erb_spec.rb" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/views/origami/in_juties/show.html.erb_spec.rb" />
|
||||
<change type="DELETED" beforePath="$PROJECT_DIR$/app/controllers/origami/commissions_controller.rb" afterPath="" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/.generators" afterPath="$PROJECT_DIR$/.idea/.generators" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/config/routes.rb" afterPath="$PROJECT_DIR$/config/routes.rb" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/.bundle/" />
|
||||
<ignored path="$PROJECT_DIR$/components/" />
|
||||
@@ -63,7 +39,7 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="in_juty.rb" pinned="false" current-in-tab="true">
|
||||
<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">
|
||||
@@ -73,6 +49,16 @@
|
||||
</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">
|
||||
@@ -183,11 +169,11 @@
|
||||
<option value="$PROJECT_DIR$/app/assets/javascripts/application.js" />
|
||||
<option value="$PROJECT_DIR$/app/assets/stylesheets/application.scss" />
|
||||
<option value="$PROJECT_DIR$/app/views/origami/commissioners/index.html.erb" />
|
||||
<option value="$PROJECT_DIR$/app/controllers/origami/commissions_controller.rb" />
|
||||
<option value="$PROJECT_DIR$/db/migrate/20170823075203_create_in_juties.rb" />
|
||||
<option value="$PROJECT_DIR$/db/migrate/20170823081747_create_in_juties.rb" />
|
||||
<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" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@@ -605,12 +591,12 @@
|
||||
<workItem from="1503328001970" duration="20307000" />
|
||||
<workItem from="1503406983258" duration="261000" />
|
||||
<workItem from="1503457057830" duration="7166000" />
|
||||
<workItem from="1503472116907" duration="3369000" />
|
||||
<workItem from="1503472116907" duration="3888000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="84511000" />
|
||||
<option name="totallyTimeSpent" value="85030000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="1442" y="22" width="1920" height="721" extended-state="0" />
|
||||
@@ -621,19 +607,19 @@
|
||||
<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="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" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Messages" 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="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Message" 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="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" 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="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3277439" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" 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="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@@ -936,14 +922,6 @@
|
||||
</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="209">
|
||||
<caret line="75" column="26" lean-forward="false" selection-start-line="75" selection-start-column="26" selection-end-line="75" selection-end-column="26" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/db/migrate/20170823075203_create_in_juties.rb">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="108">
|
||||
@@ -1008,5 +986,13 @@
|
||||
</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" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
||||
91
app/controllers/origami/commissions_controller.rb
Normal file
91
app/controllers/origami/commissions_controller.rb
Normal file
@@ -0,0 +1,91 @@
|
||||
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
|
||||
@products = MenuItem.all
|
||||
end
|
||||
|
||||
# GET /commissions/1/edit
|
||||
def edit
|
||||
@products = MenuItem.all
|
||||
end
|
||||
|
||||
# POST /commissions
|
||||
# POST /commissions.json
|
||||
def create
|
||||
@commission = Commission.new(commission_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @commission.save
|
||||
format.html {redirect_to origami_commissions_path, notice: 'Commission was successfully created.'}
|
||||
format.json {render :show, status: :created, location: @commission}
|
||||
else
|
||||
format.html {render :new}
|
||||
format.json {render json: @commission.errors, status: :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /commissions/1
|
||||
# PATCH/PUT /commissions/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @commission.update(commission_params)
|
||||
format.html {redirect_to origami_commission_path(@commission), notice: 'Commission was successfully updated.'}
|
||||
format.json {render :show, status: :ok, location: @commission}
|
||||
else
|
||||
format.html {render :edit}
|
||||
format.json {render json: @commission.errors, status: :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /commissions/1
|
||||
# DELETE /commissions/1.json
|
||||
def destroy
|
||||
@commission.destroy
|
||||
respond_to do |format|
|
||||
format.html {redirect_to origami_commissions_path, notice: 'Commission was successfully destroyed.'}
|
||||
format.json {head :no_content}
|
||||
end
|
||||
end
|
||||
|
||||
def load_commissioners
|
||||
sale_id = params[:sale_id]
|
||||
@table_id = params[:table_id]
|
||||
@saleobj = Sale.find(sale_id)
|
||||
|
||||
@commissioners = []
|
||||
end
|
||||
|
||||
def select_sale_item
|
||||
# byebug
|
||||
sale_item_id = params[:sale_item_id]
|
||||
@sale_item = SaleItem.find_by_sale_item_id(sale_item_id)
|
||||
@commissioners = Commissioner.active.all
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commission
|
||||
@commission = Commission.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def commission_params
|
||||
params.require(:commission).permit(:product_id, :amount, :commission_type, :is_active)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user