diff --git a/app/controllers/accountants_controller.rb b/app/controllers/accountants_controller.rb index c3b4b7c2c..4f90f7f73 100644 --- a/app/controllers/accountants_controller.rb +++ b/app/controllers/accountants_controller.rb @@ -3,6 +3,7 @@ class AccountantsController < ApplicationController before_action :confirm_data_access, only: [:index] before_action :confirm_data_access_async, only: [:search, :edit] before_action :find_patient, only: [:edit] + before_action :set_clinics, only: [:index] def index @patients = Patient.where(pledge_sent: true) @@ -25,6 +26,11 @@ def edit private + def set_clinics + @clinics = Clinic.all + @selected_clinics = (params[:clinic_id] || []).map(&:to_i) + end + def find_patient @patient = Patient.find params[:id] end diff --git a/app/views/accountants/_search_form.html.erb b/app/views/accountants/_search_form.html.erb index 64d500e8c..6f01c216f 100644 --- a/app/views/accountants/_search_form.html.erb +++ b/app/views/accountants/_search_form.html.erb @@ -5,18 +5,38 @@ method: 'GET' do |f| %> <%= f.hidden_field :locale, value: params[:locale] %> <%= f.text_field :search, - placeholder: t('accountants.search_placeholder'), - hide_label: true, - value: params[:search], - class: 'search_form_input accountant mr-4' %> - - <%= f.select :clinic_id, - options_for_select(clinic_options.reject{ |x| x.blank? }, - params[:clinic_id]), + placeholder: t("accountants.search_placeholder"), hide_label: true, - include_blank: t('accountants.search_all_clinics'), - class: 'search_form_input accountant' %> + value: params[:search], + class: "search_form_input accountant mr-4" %> + + <%= f.button title: t('common.search'), class: 'btn btn-primary ml-4' do %> <% end %>