aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/clients_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/clients_controller.rb')
-rw-r--r--app/controllers/clients_controller.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb
index 6110029..a8087c7 100644
--- a/app/controllers/clients_controller.rb
+++ b/app/controllers/clients_controller.rb
@@ -22,6 +22,19 @@ class ClientsController < ApplicationController
end
end
+ def edit
+ @client = Client.find(params[:id])
+ end
+
+ def update
+ @client = Client.find(params[:id])
+ if @client.update(client_params)
+ redirect_to show_clients_path(uuid: @client.uuid), notice: 'Client Updated!'
+ else
+ render :edit, status: :unprocessable_entity
+ end
+ end
+
def find
query = params[:q].downcase
json = Client.where('lower(first_name) LIKE ? OR lower(last_name) LIKE ? OR mobile_number = ?', query, query, query)
@@ -44,6 +57,8 @@ class ClientsController < ApplicationController
:first_name,
:last_name,
:member_type,
+ :id,
+ :_destroy,
],
)
end