commission update -> change route under settings
This commit is contained in:
1344
.idea/workspace.xml
generated
1344
.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -60,4 +60,31 @@ ul.dropdown-menu li a{
|
||||
|
||||
.padding-10 {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Colors */
|
||||
.purple {
|
||||
background-color:#7a62d3;
|
||||
}
|
||||
|
||||
.orange{
|
||||
background-color:#FF7F50;
|
||||
}
|
||||
|
||||
.red {
|
||||
background-color:#ff0000;
|
||||
}
|
||||
|
||||
.green{
|
||||
background-color: #009900;
|
||||
}
|
||||
|
||||
.orange{
|
||||
background-color: #FF8C00;
|
||||
}
|
||||
|
||||
.blue{
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
/* End Colors */
|
||||
@@ -62,15 +62,16 @@ class Origami::ProductCommissionsController < ApplicationController
|
||||
end
|
||||
|
||||
def set_commissioner_to_sale_item
|
||||
# byebug
|
||||
deselect = false
|
||||
sale_item_id = params[:sale_item_id]
|
||||
commissioner_id = params[:commissioner_id]
|
||||
@sale_item = SaleItem.find(sale_item_id)
|
||||
@menu_item = MenuItem.find_by_item_code(@sale_item.product_code)
|
||||
@commission = Commission.where('product_id = ? AND is_active = ?', @menu_item.id, true).take
|
||||
@commission = Commission.where('product_code = ? AND is_active = ?', @menu_item.id, true).take
|
||||
@commissioner = Commissioner.where('id = ? AND is_active = ?', commissioner_id, true).take
|
||||
@product_commission = ProductCommission.where('sale_item_id = ?', @sale_item.id).take
|
||||
# byebug
|
||||
|
||||
if !@product_commission.nil?
|
||||
if @product_commission.commissioner_id == @commissioner.id
|
||||
@product_commission.destroy
|
||||
@@ -81,7 +82,8 @@ class Origami::ProductCommissionsController < ApplicationController
|
||||
end
|
||||
else
|
||||
@product_commission = ProductCommission.new
|
||||
@product_commission.product_id = @menu_item.id
|
||||
@product_commission.product_code = @menu_item.id
|
||||
@product_commission.product_type = 'menu_item' # use for dummy data ToDo::need to change product type
|
||||
unless @commission.nil?
|
||||
@product_commission.commission_id = @commission.id
|
||||
if @commission.commission_type == 'Percentage'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::CommissionersController < BaseOrigamiController
|
||||
class Settings::CommissionersController < ApplicationController
|
||||
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /commissioners
|
||||
@@ -29,7 +29,7 @@ class Origami::CommissionersController < BaseOrigamiController
|
||||
@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.html { redirect_to settings_commissioners_path , notice: 'Commissioner was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @commissioner }
|
||||
else
|
||||
format.html { render :new }
|
||||
@@ -43,7 +43,7 @@ class Origami::CommissionersController < BaseOrigamiController
|
||||
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.html { redirect_to settings_commissioner_path(@commissioner) , notice: 'Commissioner was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @commissioner }
|
||||
else
|
||||
format.html { render :edit }
|
||||
@@ -57,7 +57,7 @@ class Origami::CommissionersController < BaseOrigamiController
|
||||
def destroy
|
||||
@commissioner.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully destroyed.' }
|
||||
format.html { redirect_to settings_commissioners_path , notice: 'Commissioner was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
@@ -70,6 +70,6 @@ class Origami::CommissionersController < BaseOrigamiController
|
||||
|
||||
# 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)
|
||||
params.require(:commissioner).permit(:name,:emp_id,:created_by,:commission_id,:joined_date,:resigned_date, :is_active)
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
class Origami::CommissionsController < BaseOrigamiController
|
||||
class Settings::CommissionsController < ApplicationController
|
||||
before_action :set_commission, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /commissions
|
||||
@@ -27,10 +27,11 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
# POST /commissions.json
|
||||
def create
|
||||
@commission = Commission.new(commission_params)
|
||||
@commission.product_type = 'menu_item'
|
||||
|
||||
respond_to do |format|
|
||||
if @commission.save
|
||||
format.html {redirect_to origami_commissions_path, notice: 'Commission was successfully created.'}
|
||||
format.html {redirect_to settings_commissions_path, notice: 'Commission was successfully created.'}
|
||||
format.json {render :show, status: :created, location: @commission}
|
||||
else
|
||||
format.html {render :new}
|
||||
@@ -44,7 +45,7 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
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.html {redirect_to settings_commission_path(@commission), notice: 'Commission was successfully updated.'}
|
||||
format.json {render :show, status: :ok, location: @commission}
|
||||
else
|
||||
format.html {render :edit}
|
||||
@@ -58,7 +59,7 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
def destroy
|
||||
@commission.destroy
|
||||
respond_to do |format|
|
||||
format.html {redirect_to origami_commissions_path, notice: 'Commission was successfully destroyed.'}
|
||||
format.html {redirect_to settings_commissions_path, notice: 'Commission was successfully destroyed.'}
|
||||
format.json {head :no_content}
|
||||
end
|
||||
end
|
||||
@@ -96,6 +97,6 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
|
||||
# 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)
|
||||
params.require(:commission).permit(:product_type, :product_code, :amount, :commission_type, :is_active)
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
class Commission < ApplicationRecord
|
||||
belongs_to :menu_item, foreign_key: 'product_id'
|
||||
belongs_to :menu_item, foreign_key: 'product_code'
|
||||
has_many :commissioners
|
||||
has_many :product_commissions
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Commissioner < ApplicationRecord
|
||||
belongs_to :employee, foreign_key: 'emp_id'
|
||||
belongs_to :commission, foreign_key: 'commission_type'
|
||||
belongs_to :commission, foreign_key: 'commission_id'
|
||||
has_many :in_juties
|
||||
has_many :product_commissions
|
||||
scope :active, -> { where(is_active: true) }
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
<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 "Commissions", origami_commissions_path , :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Commissioners", origami_commissioners_path , :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Commissions", settings_commissions_path , :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Commissioners", settings_commissioners_path , :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
|
||||
<hr class="hr_advance" />
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:origami, @commissioner]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :name %>
|
||||
<%= f.label :emp_id %>
|
||||
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %><br/>
|
||||
<%= f.label :commission_type %>
|
||||
<%= f.select :commission_type, Commission.all.map{ |l| [l.menu_item.name, l.id] } %>
|
||||
<br/>
|
||||
<label><%= f.check_box :is_active %> Active </label>
|
||||
</div><br/>
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
|
||||
<%= f.button :submit, class: 'btn btn-info' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
22
app/views/settings/commissioners/_form.html.erb
Normal file
22
app/views/settings/commissioners/_form.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:settings, @commissioner]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :name %>
|
||||
<%= f.label :emp_id, 'Employee' %>
|
||||
<%= f.collection_select :emp_id, Employee.all.order('name asc'), :id, :name, {prompt: 'Select an Employee'}, {class: "form-control"} %>
|
||||
<br/>
|
||||
<%= f.label :commission_id, 'Commission' %><br/>
|
||||
<%= f.select :commission_id, Commission.all.map {|l| [l.menu_item.name, l.id]}, {prompt: 'Select a Product'}, {class: 'form-control'} %>
|
||||
<br/>
|
||||
<label><%= f.check_box :is_active %> Active </label>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
|
||||
<%= f.button :submit, class: 'btn btn-info' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Commissioners</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">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' %>
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_settings_commissioner_path, :class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -30,9 +30,9 @@
|
||||
</td>
|
||||
<td><%= commissioner.commission.menu_item.name rescue '-' %></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>
|
||||
<td><%= link_to 'Show', settings_commissioner_path(commissioner) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_commissioner_path(commissioner) %></td>
|
||||
<td><%= link_to 'Destroy', settings_commissioner_path(commissioner), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioners_path %>">Commissioners</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissioners_path %>">Commissioners</a></li>
|
||||
<li><a href="<%= settings_commissioner_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissioner_path %>">Commissioners</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
@@ -38,9 +38,9 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= link_to 'Back', origami_commissioners_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_origami_commissioner_path(@commissioner), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', origami_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
|
||||
<%= link_to 'Back', settings_commissioners_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_settings_commissioner_path(@commissioner), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', settings_commissioner_path(@commissioner), method: :delete, data: {confirm: 'Are you sure?'}, class: 'btn btn-danger' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<div class="col-md-3">
|
||||
<%= simple_form_for([:origami,@commission]) do |f| %>
|
||||
<%= simple_form_for([:settings,@commission]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.label :product_id %>
|
||||
<%= f.collection_select :product_id, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>
|
||||
<%= f.input :amount %>
|
||||
<%= f.label :product_code, 'Product' %>
|
||||
<%= f.collection_select :product_code, @products, :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>
|
||||
<%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %>
|
||||
<%= f.input :amount %>
|
||||
<label><%= f.check_box :is_active %> Active </label>
|
||||
|
||||
</div><br>
|
||||
<div class="form-actions">
|
||||
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Back', settings_commissions_path, class: 'btn btn-success' %>
|
||||
<%= f.button :submit, class: 'btn btn-info' %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Commissions</a></li>
|
||||
<li>Edit</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Home</a></li>
|
||||
<li>Commissions</li>
|
||||
<span style="float: right">
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commission_path, :class => 'btn btn-primary btn-sm' %>
|
||||
<%= link_to t('.new', :default => t("helpers.links.new")), new_settings_commission_path, :class => 'btn btn-primary btn-sm' %>
|
||||
</span>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -28,9 +28,9 @@
|
||||
<td><%= commission.amount rescue '-' %></td>
|
||||
<td><%= commission.commission_type rescue '-' %></td>
|
||||
<td><%= commission.is_active rescue '-' %></td>
|
||||
<td><%= link_to 'Show', origami_commission_path(commission) %></td>
|
||||
<td><%= link_to 'Edit', edit_origami_commission_path(commission) %></td>
|
||||
<td><%= link_to 'Destroy', origami_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
<td><%= link_to 'Show', settings_commissions_path(commission) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_commission_path(commission) %></td>
|
||||
<td><%= link_to 'Destroy', settings_commission_path(commission), method: :delete, data: {confirm: 'Are you sure?'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="span12">
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Commissions</a></li>
|
||||
<li>New</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= origami_root_path %>">Home</a></li>
|
||||
<li><a href="<%= origami_commissions_path %>">Commissions</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Home</a></li>
|
||||
<li><a href="<%= settings_commissions_path %>">Commissions</a></li>
|
||||
|
||||
<span style="float: right">
|
||||
</span>
|
||||
@@ -32,9 +32,9 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= link_to 'Back', origami_commissions_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_origami_commission_path(@commission), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', origami_commission_path(@commission), method: :delete, class: 'btn btn-danger', data: {confirm: 'Are you sure?'} %>
|
||||
<%= link_to 'Back', settings_commissions_path, class: 'btn btn-success' %>
|
||||
<%= link_to 'Edit', edit_settings_commission_path(@commission), class: 'btn btn-info' %>
|
||||
<%= link_to 'Destroy', settings_commissions_path(@commission), method: :delete, class: 'btn btn-danger', data: {confirm: 'Are you sure?'} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,10 +11,10 @@ Rails.application.routes.draw do
|
||||
|
||||
#--------- SmartSales Installation ------------#
|
||||
get 'install' => 'install#index'
|
||||
post 'install' => 'install#create'
|
||||
post 'install' => 'install#create'
|
||||
|
||||
#--------- Login/Authentication ------------#
|
||||
get 'auth/:emp_id' => 'home#show' , as: :emp_login
|
||||
get 'auth/:emp_id' => 'home#show', as: :emp_login
|
||||
patch "auth/:emp_id" => 'home#update', as: :emp_login_update
|
||||
|
||||
post 'login' => 'home#create'
|
||||
@@ -23,14 +23,14 @@ Rails.application.routes.draw do
|
||||
|
||||
|
||||
#--------- API Routes ------------#
|
||||
namespace :api, :defaults => { :format => 'json' } do
|
||||
namespace :api, :defaults => {:format => 'json'} do
|
||||
#Session Login and Logout
|
||||
post 'authenticate' => "authenticate#create"
|
||||
post 'authenticate' => "authenticate#create"
|
||||
delete 'authenticate' => "authenticate#destroy"
|
||||
|
||||
namespace :restaurant do
|
||||
get 'zones' => "zones#index"
|
||||
resources :menu, only:[:index, :show]
|
||||
resources :menu, only: [:index, :show]
|
||||
resources :menu_categories, only: [:index, :show]
|
||||
resources :menu_items, only: [:index, :show]
|
||||
resources :menu_item_attributes, only: [:index]
|
||||
@@ -57,10 +57,10 @@ Rails.application.routes.draw do
|
||||
get "customers/get_order/:id" => "customers#get_customer_order"
|
||||
|
||||
#Generating Invoice and making payments - output render @sale
|
||||
resources :invoices, only: [:index, :show, :create, :update, :destroy ] do
|
||||
resources :sale_items, only:[:create, :update, :destroy]
|
||||
resources :invoices, only: [:index, :show, :create, :update, :destroy] do
|
||||
resources :sale_items, only: [:create, :update, :destroy]
|
||||
resources :discounts, only: [:create, :update, :destroy]
|
||||
resources :memberships, only:[:create]
|
||||
resources :memberships, only: [:create]
|
||||
post "payment/:payment_method" => "payment#create"
|
||||
put "payment/:id" => "payment#update"
|
||||
resources :receipt, only: [:create, :show] #generate receipt, show receipt
|
||||
@@ -72,8 +72,8 @@ Rails.application.routes.draw do
|
||||
|
||||
#--------- Cashier ------------#
|
||||
namespace :origami do
|
||||
resources :cash_ins, only:[:new, :create]
|
||||
resources :cash_outs, only:[:new, :create]
|
||||
resources :cash_ins, only: [:new, :create]
|
||||
resources :cash_outs, only: [:new, :create]
|
||||
root "home#index"
|
||||
get "table/:dining_id" => "home#show" do #origami/:booking_id will show
|
||||
# resources :discounts, only: [:index,:new, :create ] #add discount type
|
||||
@@ -87,16 +87,11 @@ Rails.application.routes.draw do
|
||||
post 'item_void_cancel' => "sale_edit#item_void_cancel"
|
||||
post 'cancel_all_void' => 'sale_edit#cancel_all_void'
|
||||
post 'apply_void' => 'sale_edit#apply_void'
|
||||
# commissions
|
||||
get '/table/:table_id/sale/:sale_id/load_commissioners' => 'commissions#load_commissioners', as: 'load_commissioners'
|
||||
post 'select_sale_item' => 'commissions#select_sale_item'
|
||||
# product_commission
|
||||
post 'select_commissioner' => 'product_commissions#set_commissioner_to_sale_item'
|
||||
# in_juties
|
||||
get '/table/:table_id/assign_in_juty' => 'in_juties#assign_in_juty', as: 'assign_in_juty'
|
||||
post 'assign_in_juty' => 'in_juties#create_for_in_juty', as: 'create_for_in_juty'
|
||||
get 'assign_in_juty/:table_id' => 'in_juties#index_in_juty', as: 'index_in_juty'
|
||||
get 'table/:table_id/in_juty/:id/edit' => 'in_juties#edit_in_juty' ,as: 'edit_in_juty'
|
||||
get 'table/:table_id/in_juty/:id/edit' => 'in_juties#edit_in_juty', as: 'edit_in_juty'
|
||||
put '/edit_in_juty/:id' => 'in_juties#update_for_in_juty', as: 'update_for_in_juty'
|
||||
delete 'table/:table_id/destroy_in_juty/:id' => 'in_juties#destroy_in_juty', as: 'destroy_in_juty'
|
||||
|
||||
@@ -122,8 +117,8 @@ Rails.application.routes.draw do
|
||||
# Discount for Member
|
||||
post "/:id/member_discount" => "discounts#member_discount"
|
||||
|
||||
get "/:id/request_bills" => "request_bills#print",:as => "request_bill"
|
||||
get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' }
|
||||
get "/:id/request_bills" => "request_bills#print", :as => "request_bill"
|
||||
get '/:sale_id/reprint' => 'payments#reprint', :defaults => {:format => 'json'}
|
||||
|
||||
#---------Shift ---------------#
|
||||
resources :shifts, only: [:index, :new, :create, :edit]
|
||||
@@ -141,11 +136,11 @@ Rails.application.routes.draw do
|
||||
#payment - Outing payments - Cash only [ *Misc expeness tracking]
|
||||
|
||||
#--------- Payment ------------#
|
||||
post 'sale/:sale_id/rounding_adj' => 'payments#rounding_adj',:as => "calculate_rouding_adjs"
|
||||
get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => { :format => 'json' }
|
||||
post 'sale/:sale_id/rounding_adj' => 'payments#rounding_adj', :as => "calculate_rouding_adjs"
|
||||
get 'sale/:sale_id/first_bill' => 'payments#first_bill', :defaults => {:format => 'json'}
|
||||
get 'sale/:sale_id/payment' => 'payments#show'
|
||||
|
||||
post 'payment/foc' => 'payments#foc', :defaults => { :format => 'json' }
|
||||
post 'payment/foc' => 'payments#foc', :defaults => {:format => 'json'}
|
||||
post 'payment/cash' => 'payments#create'
|
||||
post 'payment/mpu' => "mpu#create"
|
||||
post 'payment/jcb' => "jcb#create"
|
||||
@@ -168,43 +163,41 @@ Rails.application.routes.draw do
|
||||
post 'sale/:sale_id/void' => 'void#overall_void'
|
||||
|
||||
#---------Multiple Invoices --------------#
|
||||
get 'table/:table_id/table_invoices' => "table_invoices#index" , :as => "table_invoice_index"
|
||||
get 'table/:table_id/table_invoice/:invoice_id' => "table_invoices#show" , :as => "table_invoice_show"
|
||||
get 'room/:room_id/room_invoices' => "room_invoices#index" , :as => "room_invoice_index"
|
||||
get 'room/:room_id/room_invoice/:invoice_id' => "room_invoices#show" , :as => "room_invoice_show"
|
||||
get 'table/:table_id/table_invoices' => "table_invoices#index", :as => "table_invoice_index"
|
||||
get 'table/:table_id/table_invoice/:invoice_id' => "table_invoices#show", :as => "table_invoice_show"
|
||||
get 'room/:room_id/room_invoices' => "room_invoices#index", :as => "room_invoice_index"
|
||||
get 'room/:room_id/room_invoice/:invoice_id' => "room_invoices#show", :as => "room_invoice_show"
|
||||
|
||||
#---------Add Customer --------------#
|
||||
#resources :customers
|
||||
get '/:sale_id/customers', to: "customers#add_customer"
|
||||
get '/:customer_id/get_customer' => 'home#get_customer',:as => "show_customer_details"
|
||||
post '/:sale_id/update_sale' , to: "customers#update_sale_by_customer" # update customer id in sale table
|
||||
get '/:customer_id/get_customer' => 'home#get_customer', :as => "show_customer_details"
|
||||
post '/:sale_id/update_sale', to: "customers#update_sale_by_customer" # update customer id in sale table
|
||||
|
||||
post '/:sale_id/get_customer' => "customers#get_customer"
|
||||
|
||||
resources :addorders
|
||||
resources :commissions
|
||||
resources :commissioners
|
||||
resources :in_juties
|
||||
end
|
||||
|
||||
#--------- Waiter/Ordering Station ------------#
|
||||
namespace :oishi do
|
||||
#zones
|
||||
#tables
|
||||
#orders
|
||||
#zones
|
||||
#tables
|
||||
#orders
|
||||
end
|
||||
|
||||
#--------- Customer Relationship Management ------------#
|
||||
namespace :crm do
|
||||
root "home#index"
|
||||
resources :customers
|
||||
resources :dining_queues
|
||||
post "update_booking" , to: "bookings#update_booking", as: "update_booking"#assign and cancel
|
||||
get '/print/:id', to: "home#print_order"#print order for crm
|
||||
root "home#index"
|
||||
resources :customers
|
||||
resources :dining_queues
|
||||
post "update_booking", to: "bookings#update_booking", as: "update_booking" #assign and cancel
|
||||
get '/print/:id', to: "home#print_order" #print order for crm
|
||||
|
||||
get "/dining_queues/:id/assign" =>"dining_queues#assign", :as => "assign"
|
||||
post "/dining_queues/assign_table" =>"dining_queues#assign_table", :as => "assign_table"
|
||||
post "/dining_queues/cancel_queue" =>"dining_queues#cancel_queue", :as => "cancel_queue"
|
||||
get "/dining_queues/:id/assign" => "dining_queues#assign", :as => "assign"
|
||||
post "/dining_queues/assign_table" => "dining_queues#assign_table", :as => "assign_table"
|
||||
post "/dining_queues/cancel_queue" => "dining_queues#cancel_queue", :as => "cancel_queue"
|
||||
|
||||
end
|
||||
|
||||
@@ -223,7 +216,7 @@ Rails.application.routes.draw do
|
||||
get 'print/print/:id', to: "print#print"
|
||||
get 'print/print_order_summary/:id', to: "print#print_order_summary"
|
||||
|
||||
get "/get_items/:id" =>"home#get_items_by_oqs", :as => "get_order_items_by_oqs"
|
||||
get "/get_items/:id" => "home#get_items_by_oqs", :as => "get_order_items_by_oqs"
|
||||
#dashboard
|
||||
#
|
||||
end
|
||||
@@ -235,7 +228,7 @@ Rails.application.routes.draw do
|
||||
#menu
|
||||
resources :menus do
|
||||
#menu_categories
|
||||
resources :menu_categories, only: [:new, :create, :edit,:delete]
|
||||
resources :menu_categories, only: [:new, :create, :edit, :delete]
|
||||
end
|
||||
|
||||
resources :item_sets
|
||||
@@ -299,16 +292,26 @@ Rails.application.routes.draw do
|
||||
resources :promotion_products
|
||||
end
|
||||
|
||||
# commission
|
||||
resources :commissions
|
||||
resources :commissioners
|
||||
|
||||
end
|
||||
|
||||
# commissions
|
||||
get 'origami/table/:table_id/sale/:sale_id/load_commissioners' => 'settings/commissions#load_commissioners', as: 'load_commissioners'
|
||||
post 'origami/select_sale_item' => 'settings/commissions#select_sale_item', as: 'select_sale_item'
|
||||
# product_commission
|
||||
post 'origami/select_commissioner' => 'origami/product_commissions#set_commissioner_to_sale_item', as: 'select_commissioner'
|
||||
|
||||
#--------- Transactions Sections ------------#
|
||||
namespace :transactions do
|
||||
resources :sales
|
||||
resources :orders
|
||||
resources :credit_notes
|
||||
|
||||
get "/sales/:sale_id/manual_complete_sale" =>"manual_sales#manual_complete_sale", :as => "manual_complete_sale"
|
||||
get "/sales/:sale_id/void" =>"manual_sales#void", :as => "void"
|
||||
get "/sales/:sale_id/manual_complete_sale" => "manual_sales#manual_complete_sale", :as => "manual_complete_sale"
|
||||
get "/sales/:sale_id/void" => "manual_sales#void", :as => "void"
|
||||
post "sales/:sale_id/manual_void_sale", to: "manual_sales#manual_void_sale", :as => "manual_void_sale"
|
||||
end
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
class CreateCommissioners < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :commissioners do |t|
|
||||
t.string :name, :null => false
|
||||
t.string :emp_id
|
||||
t.string :created_by
|
||||
t.string :commission_type
|
||||
t.boolean :is_active
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,16 +0,0 @@
|
||||
class CreateProductCommissions < ActiveRecord::Migration[5.1]
|
||||
# rake db:migrate:down VERSION=20170823034141
|
||||
def change
|
||||
create_table :product_commissions do |t|
|
||||
t.string :product_id
|
||||
t.integer :commission_id
|
||||
t.integer :commissioner_id
|
||||
t.decimal :qty, :precision => 10, :scale => 2, :default => 0.00
|
||||
t.string :sale_id
|
||||
t.string :sale_item_id
|
||||
t.decimal :price, :precision => 10, :scale => 2, :default => 0.00
|
||||
t.decimal :amount, :precision => 10, :scale => 2, :default => 0.00
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
17
db/migrate/20170825034141_create_product_commissions.rb
Normal file
17
db/migrate/20170825034141_create_product_commissions.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class CreateProductCommissions < ActiveRecord::Migration[5.1]
|
||||
# rake db:migrate:down VERSION=20170825034141
|
||||
def change
|
||||
create_table :product_commissions do |t|
|
||||
t.string :product_type
|
||||
t.string :product_code
|
||||
t.integer :commission_id
|
||||
t.integer :commissioner_id
|
||||
t.decimal :qty, precision: 10, scale: 2, default: 0.00
|
||||
t.string :sale_id
|
||||
t.string :sale_item_id
|
||||
t.decimal :price, precision: 10, scale: 2, default: 0.00
|
||||
t.decimal :amount, precision: 10, scale: 2, default: 0.00
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
15
db/migrate/20170825090115_create_commissioners.rb
Normal file
15
db/migrate/20170825090115_create_commissioners.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class CreateCommissioners < ActiveRecord::Migration[5.1]
|
||||
# rake db:migrate:down VERSION=20170825090115
|
||||
def change
|
||||
create_table :commissioners do |t|
|
||||
t.string :name
|
||||
t.string :emp_id
|
||||
t.string :created_by
|
||||
t.integer :commission_id
|
||||
t.datetime :joined_date
|
||||
t.datetime :resigned_date
|
||||
t.boolean :is_active, default: true
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,10 +1,12 @@
|
||||
class CreateCommissions < ActiveRecord::Migration[5.1]
|
||||
# rake db:migrate:down VERSION=20170825093252
|
||||
def change
|
||||
create_table :commissions do |t|
|
||||
t.integer :product_id, null: false
|
||||
t.integer :amount
|
||||
t.string :product_type
|
||||
t.string :product_code
|
||||
t.string :commission_type
|
||||
t.boolean :is_active
|
||||
t.integer :amount
|
||||
t.boolean :is_active, default: true
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user