diff --git a/app/controllers/api/bookings_controller.rb b/app/controllers/api/bookings_controller.rb index 03ca0b5d..ca7df569 100644 --- a/app/controllers/api/bookings_controller.rb +++ b/app/controllers/api/bookings_controller.rb @@ -11,13 +11,17 @@ class Api::BookingsController < Api::ApiController end def update_booking + booking = Booking.find(params[:booking_id]) + status = booking.update_attributes(booking_status: params[:type]) + + if status + render json: JSON.generate({:status => true ,:type => params[:type]}) + else + render json: JSON.generate({:status => false, :error_message => "Record not found"}) -booking = Booking.find_by(id: params[:booking]) -booking.update_all(booking_status: 'Dave') - - - end + end + end # private # def Bookings_params diff --git a/app/views/crm/home/_booking.html.erb b/app/views/crm/home/_booking.html.erb index 09e835c0..c9200f3e 100644 --- a/app/views/crm/home/_booking.html.erb +++ b/app/views/crm/home/_booking.html.erb @@ -3,30 +3,32 @@ <% @i = 0 %> <% @booking.each do |booking| %> -
-
-

- <%= @i += 1 %> . <%= booking.dining_facility.name %> - - <%= booking.id %> -

- -

- - Order at <%= booking.checkin_at.strftime("%H,%m") %>, <%= booking.checkin_by %> - -

-
- \ No newline at end of file diff --git a/app/views/crm/home/index.html.erb b/app/views/crm/home/index.html.erb index 800ff2f9..431ef4a4 100644 --- a/app/views/crm/home/index.html.erb +++ b/app/views/crm/home/index.html.erb @@ -5,10 +5,10 @@
- - -
@@ -67,10 +64,7 @@ Table/Room - - - diff --git a/config/routes.rb b/config/routes.rb index 3692a90e..0aaa2cea 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -47,7 +47,7 @@ Rails.application.routes.draw do resources :bookings, only: [:index, :show, :create, :update] resources :customers, only: [:index, :show, :create, :update] - get "update_booking" , to: "bookings#update_booking", as: "update_booking" + post "update_booking" , to: "bookings#update_booking", as: "update_booking" #Generating Invoice and making payments - output render @sale resources :invoices, only: [:index, :show, :create, :update, :destroy ] do