assign queue and other bug
This commit is contained in:
@@ -4,7 +4,8 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
# GET /crm/dining_queues
|
||||
# GET /crm/dining_queues.json
|
||||
def index
|
||||
@dining_queues = DiningQueue.all
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
@dining_queues = DiningQueue.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? ", today).order("queue_no asc")
|
||||
end
|
||||
|
||||
# GET /crm/dining_queues/1
|
||||
@@ -38,7 +39,7 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_queue_no(print_settings,@dining_queue)
|
||||
|
||||
format.html { redirect_to crm_dining_queues_path, notice: 'Dining queue was successfully created.' }
|
||||
format.html { redirect_to crm_dining_queues_path, notice: 'Queue was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @dining_queue }
|
||||
else
|
||||
format.html { render :new }
|
||||
@@ -52,7 +53,7 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @dining_queue.update(dining_queue_params)
|
||||
format.html { redirect_to crm_dining_queues_path, notice: 'Dining queue was successfully updated.' }
|
||||
format.html { redirect_to crm_dining_queues_path, notice: 'Queue was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @dining_queue }
|
||||
else
|
||||
format.html { render :edit }
|
||||
@@ -71,6 +72,27 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
end
|
||||
end
|
||||
|
||||
def assign
|
||||
@queue = DiningQueue.find(params[:id])
|
||||
@tables = DiningFacility.where("status = 'available' ")
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
end
|
||||
end
|
||||
|
||||
def assign_table
|
||||
queue = DiningQueue.find(params[:id])
|
||||
table_id = params[:table_id]
|
||||
|
||||
queue.update_attributes(dining_facility_id: table_id,status:"Assign")
|
||||
DiningFacility.find(table_id).update_attributes(status: "occupied")
|
||||
respond_to do |format|
|
||||
format.html { redirect_to crm_dining_queues_path, notice: 'Table was successfully assigned.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_dining_queue
|
||||
@@ -79,6 +101,6 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def dining_queue_params
|
||||
params.require(:dining_queue).permit(:name, :contact_no, :queue_no)
|
||||
params.require(:dining_queue).permit(:name, :contact_no, :queue_no,:status)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user