check induties process
This commit is contained in:
@@ -2,10 +2,9 @@ class Origami::InDutiesController < BaseOrigamiController
|
|||||||
before_action :set_in_duty, only: %i[show edit update edit_in_duty update_for_in_duty destroy destroy_in_duty]
|
before_action :set_in_duty, only: %i[show edit update edit_in_duty update_for_in_duty destroy destroy_in_duty]
|
||||||
|
|
||||||
def index_in_duty
|
def index_in_duty
|
||||||
@sale_id = params[:sale_id]
|
@booking_id = params[:booking_id]
|
||||||
booking = Booking.where("sale_id=?",@sale_id).first
|
booking = Booking.where("booking_id=?",@booking_id).first
|
||||||
@booking_id = booking.booking_id
|
@duty_in = InDuty.where('dinning_id=? and booking_id=?', booking.dining_facility_id, @booking_id)
|
||||||
@duty_in = InDuty.where('dinning_id=? and sale_id=?', booking.dining_facility_id, @sale_id)
|
|
||||||
@table = DiningFacility.find(booking.dining_facility_id)
|
@table = DiningFacility.find(booking.dining_facility_id)
|
||||||
@in_duty = InDuty.new
|
@in_duty = InDuty.new
|
||||||
@duties_in = Kaminari.paginate_array(@duty_in).page(params[:page]).per(10)
|
@duties_in = Kaminari.paginate_array(@duty_in).page(params[:page]).per(10)
|
||||||
@@ -29,8 +28,7 @@ class Origami::InDutiesController < BaseOrigamiController
|
|||||||
|
|
||||||
def edit_in_duty
|
def edit_in_duty
|
||||||
@in_duty = InDuty.find(params[:id])
|
@in_duty = InDuty.find(params[:id])
|
||||||
@sale_id = params[:sale_id]
|
booking = Booking.where("booking_id=?",@in_duty.booking_id).first
|
||||||
booking = Booking.where("sale_id=?",@sale_id).first
|
|
||||||
@booking_id = booking.booking_id
|
@booking_id = booking.booking_id
|
||||||
@table = DiningFacility.find(booking.dining_facility_id)
|
@table = DiningFacility.find(booking.dining_facility_id)
|
||||||
@commissioner = @in_duty.commissioner
|
@commissioner = @in_duty.commissioner
|
||||||
@@ -60,10 +58,14 @@ class Origami::InDutiesController < BaseOrigamiController
|
|||||||
unless in_duty_id.empty?
|
unless in_duty_id.empty?
|
||||||
@in_duty = InDuty.find(in_duty_id.to_i)
|
@in_duty = InDuty.find(in_duty_id.to_i)
|
||||||
end
|
end
|
||||||
|
data = InDuty.find_by_booking_id(in_duty_params[:booking_id])
|
||||||
|
if !data.nil?
|
||||||
|
if !data.sale_id.nil?
|
||||||
|
@in_duty.sale_id = data.sale_id
|
||||||
|
end
|
||||||
|
end
|
||||||
@in_duty.dinning_id = in_duty_params[:dinning_id]
|
@in_duty.dinning_id = in_duty_params[:dinning_id]
|
||||||
@in_duty.booking_id = in_duty_params[:booking_id]
|
@in_duty.booking_id = in_duty_params[:booking_id]
|
||||||
@in_duty.sale_id = in_duty_params[:sale_id]
|
|
||||||
@in_duty.commissioner_ids = in_duty_params[:commissioner_ids]
|
@in_duty.commissioner_ids = in_duty_params[:commissioner_ids]
|
||||||
@in_duty.in_time = in_duty['in_time']
|
@in_duty.in_time = in_duty['in_time']
|
||||||
@in_duty.out_time = in_duty['out_time']
|
@in_duty.out_time = in_duty['out_time']
|
||||||
@@ -97,7 +99,7 @@ class Origami::InDutiesController < BaseOrigamiController
|
|||||||
@in_duty.out_time = in_duty_params[:out_time]
|
@in_duty.out_time = in_duty_params[:out_time]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @in_duty.save
|
if @in_duty.save
|
||||||
format.html { redirect_to origami_index_in_duty_path(in_duty_params[:sale_id]), notice: 'In duty was successfully updated.' }
|
format.html { redirect_to origami_index_in_duty_path(in_duty_params[:booking_id]), notice: 'In duty was successfully updated.' }
|
||||||
format.json { render :show, status: :ok, location: @in_duty }
|
format.json { render :show, status: :ok, location: @in_duty }
|
||||||
else
|
else
|
||||||
format.html { render :edit }
|
format.html { render :edit }
|
||||||
@@ -110,9 +112,8 @@ class Origami::InDutiesController < BaseOrigamiController
|
|||||||
# DELETE /in_duties/1.json
|
# DELETE /in_duties/1.json
|
||||||
def destroy_in_duty
|
def destroy_in_duty
|
||||||
@table_id = params[:table_id]
|
@table_id = params[:table_id]
|
||||||
@sale_id = params[:sale_id]
|
@booking_id = params[:booking_id]
|
||||||
booking = Booking.where("sale_id=?",@sale_id).first
|
booking = Booking.where("booking_id=?",@booking_id).first
|
||||||
@booking_id = booking.booking_id
|
|
||||||
@in_duty.destroy
|
@in_duty.destroy
|
||||||
|
|
||||||
flash[:notice] = 'In duty was successfully destroyed.'
|
flash[:notice] = 'In duty was successfully destroyed.'
|
||||||
@@ -128,7 +129,7 @@ class Origami::InDutiesController < BaseOrigamiController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def in_duty_params
|
def in_duty_params
|
||||||
params.require(:in_duty).permit(:id, :dinning_id, :booking_id, :sale_id, :commissioner_ids, :in_time, :out_time)
|
params.require(:in_duty).permit(:id, :dinning_id, :booking_id, :commissioner_ids, :in_time, :out_time)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -27,6 +27,16 @@ class Origami::RequestBillsController < ApplicationController
|
|||||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source)
|
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source)
|
||||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
|
|
||||||
|
# in-duty update
|
||||||
|
in_duties = InDuty.where("booking_id=?",bk_order.booking_id)
|
||||||
|
if !in_duties.empty?
|
||||||
|
in_duties.each do |in_duty|
|
||||||
|
induty = InDuty.find(in_duty.id)
|
||||||
|
induty.sale_id = @sale_id
|
||||||
|
induty.save
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
||||||
|
|||||||
@@ -487,6 +487,7 @@
|
|||||||
<!-- <button type="button" id="discount" class="btn btn-block bg-blue waves-effect" disabled>Discount</button> -->
|
<!-- <button type="button" id="discount" class="btn btn-block bg-blue waves-effect" disabled>Discount</button> -->
|
||||||
<!-- <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect" disabled>Charges</button> -->
|
<!-- <button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect" disabled>Charges</button> -->
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='move'>Move</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" id='move'>Move</button>
|
||||||
|
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||||
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
|
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
|
||||||
<% if !@split_bill.nil? %>
|
<% if !@split_bill.nil? %>
|
||||||
<% if @split_bill == '1' %>
|
<% if @split_bill == '1' %>
|
||||||
@@ -1061,8 +1062,8 @@
|
|||||||
|
|
||||||
$('#in_duties').on('click', function () {
|
$('#in_duties').on('click', function () {
|
||||||
var dining_id = "<%= @dining.id %>";
|
var dining_id = "<%= @dining.id %>";
|
||||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
|
var booking_id = "<%= @booking.booking_id rescue "" %>";
|
||||||
window.location.href = '/origami/assign_in_duty/'+ sale_id;
|
window.location.href = '/origami/assign_in_duty/'+ booking_id;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#void').on('click', function () {
|
$('#void').on('click', function () {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||||
<%= f.hidden_field :booking_id, :value => @booking_id %>
|
<%= f.hidden_field :booking_id, :value => @booking_id %>
|
||||||
<%= f.hidden_field :sale_id, :value => @sale_id %>
|
|
||||||
<div class="form-inputs form-group">
|
<div class="form-inputs form-group">
|
||||||
<%= f.hidden_field :dinning_id, :value => @table.id, :class => "form-control col-md-4 " %>
|
<%= f.hidden_field :dinning_id, :value => @table.id, :class => "form-control col-md-4 " %>
|
||||||
<label>Commissioner Name:</label>
|
<label>Commissioner Name:</label>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<td><%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
<td><%= in_duty.in_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||||
<td><%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
<td><%= in_duty.out_time.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") rescue '-' %></td>
|
||||||
<td>
|
<td>
|
||||||
<button class="delete btn btn-danger btn-sm waves-effect" data-ref="../table/<%=in_duty.dining_facility.id%>/<%= @sale_id %>/destroy_in_duty/<%=in_duty.id%>" data-method="delete">
|
<button class="delete btn btn-danger btn-sm waves-effect" data-ref="../table/<%=in_duty.dining_facility.id%>/<%= @booking_id %>/destroy_in_duty/<%=in_duty.id%>" data-method="delete">
|
||||||
Remove
|
Remove
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -67,9 +67,9 @@
|
|||||||
$(this).closest('tr').find('.checkbox_check').prop("checked", true);
|
$(this).closest('tr').find('.checkbox_check').prop("checked", true);
|
||||||
|
|
||||||
var in_duty_id = $(this).attr('data-ref');
|
var in_duty_id = $(this).attr('data-ref');
|
||||||
var table_id = "<%= @table.id %>";
|
// var table_id = "<%= @table.id %>";
|
||||||
var sale_id = "<%= @sale_id %>";
|
// var sale_id = "<%= @sale_id %>";
|
||||||
var url = "/origami/assign_in_duty/table/" + sale_id + "/in_duty/" + in_duty_id + "/edit";
|
var url = "/origami/assign_in_duty/" + in_duty_id + "/edit";
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
|
|||||||
@@ -470,6 +470,7 @@
|
|||||||
<!-- <button type="button" id="other-charges" class="btn bg-blue btn-block" disabled>Charges</button> -->
|
<!-- <button type="button" id="other-charges" class="btn bg-blue btn-block" disabled>Charges</button> -->
|
||||||
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
|
||||||
<button type="button" class="btn bg-blue btn-block" id='move'>Move</button>
|
<button type="button" class="btn bg-blue btn-block" id='move'>Move</button>
|
||||||
|
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||||
<button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button>
|
<button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button>
|
||||||
<% if !@split_bill.nil? %>
|
<% if !@split_bill.nil? %>
|
||||||
<% if @split_bill == '1' %>
|
<% if @split_bill == '1' %>
|
||||||
@@ -1171,8 +1172,9 @@ $('#add_invoice').on('click',function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#in_duties').on('click', function () {
|
$('#in_duties').on('click', function () {
|
||||||
var dining_id = "<%= @room.id %>"
|
var dining_id = "<%= @room.id %>";
|
||||||
window.location.href = '/origami/assign_in_duty/'+ dining_id;
|
var booking_id = "<%= @booking.booking_id rescue "" %>";
|
||||||
|
window.location.href = '/origami/assign_in_duty/'+ booking_id;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ordering
|
// Ordering
|
||||||
|
|||||||
@@ -132,12 +132,12 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
post 'apply_void' => 'sale_edit#apply_void'
|
post 'apply_void' => 'sale_edit#apply_void'
|
||||||
# in_duties
|
# in_duties
|
||||||
get '/table/:sale_id/assign_in_duty' => 'in_duties#assign_in_duty', as: 'assign_in_duty'
|
get '/table/:sale_id/assign_in_duty' => 'in_duties#assign_in_duty', as: 'assign_in_duty'
|
||||||
get 'assign_in_duty/:sale_id' => 'in_duties#index_in_duty', as: 'index_in_duty'
|
get 'assign_in_duty/:booking_id' => 'in_duties#index_in_duty', as: 'index_in_duty'
|
||||||
post 'assign_in_duty/:sale_id' => 'in_duties#create_for_in_duty'
|
post 'assign_in_duty/:booking_id' => 'in_duties#create_for_in_duty'
|
||||||
|
|
||||||
get 'assign_in_duty/table/:sale_id/in_duty/:id/edit' => 'in_duties#edit_in_duty' ,as: 'edit_in_duty'
|
get 'assign_in_duty/:id/edit' => 'in_duties#edit_in_duty' ,as: 'edit_in_duty'
|
||||||
patch 'edit_in_duty/:id' => 'in_duties#update_for_in_duty', as: 'update_for_in_duty'
|
patch 'edit_in_duty/:id' => 'in_duties#update_for_in_duty', as: 'update_for_in_duty'
|
||||||
delete 'table/:table_id/:sale_id/destroy_in_duty/:id' => 'in_duties#destroy_in_duty', as: 'destroy_in_duty'
|
delete 'table/:table_id/:booking_id/destroy_in_duty/:id' => 'in_duties#destroy_in_duty', as: 'destroy_in_duty'
|
||||||
|
|
||||||
get 'table/:dining_id/movetable' => "movetable#move_dining"
|
get 'table/:dining_id/movetable' => "movetable#move_dining"
|
||||||
get 'table/:dining_id/moveroom' => "moveroom#move_dining"
|
get 'table/:dining_id/moveroom' => "moveroom#move_dining"
|
||||||
|
|||||||
Reference in New Issue
Block a user