Commit 50b77cbb authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Fix collection select order in schedules form


Signed-off-by: Bruno Freitas Tissei's avatarBruno Freitas Tissei <bft15@inf.ufpr.br>
parent 4371e488
......@@ -121,7 +121,7 @@ class ServiceTypesController < ApplicationController
# setor no formato JSON
def sector_service_types
if params[:sector_id].present?
@service_types = ServiceType.active.where(:sector_id => params[:sector_id]).pluck(:id,:description)
@service_types = ServiceType.active.where(:sector_id => params[:sector_id]).pluck(:id,:description).sort
respond_to do |format|
format.json { render json: @service_types }
end
......@@ -141,14 +141,14 @@ class ServiceTypesController < ApplicationController
# http://meltingice.net/2013/06/11/pluck-multiple-columns-rails/
if @currentProfessionalServicePlace
if @currentProfessionalServicePlace.role == "adm_c3sl"
@places = @service_type.service_places.active
@places = @service_type.service_places.active.order('name ASC')
elsif @currentProfessionalServicePlace.role == "adm_prefeitura"
@places = @service_type.service_places.active.where(:city_hall_id => @currentCityHall.id)
@places = @service_type.service_places.active.where(:city_hall_id => @currentCityHall.id).order('name ASC')
elsif ["adm_local","atendente_local"].include?(@currentProfessionalServicePlace.role)
@places = @service_type.service_places.active.where(:id => @currentProfessionalServicePlace.service_place.id)
@places = @service_type.service_places.active.where(:id => @currentProfessionalServicePlace.service_place.id).order('name ASC')
end
else
@places = @service_type.service_places.active.where(:city_hall_id => @currentCityHall.id)
@places = @service_type.service_places.active.where(:city_hall_id => @currentCityHall.id).order('name ASC')
end
@places = ActiveRecord::Base.connection.select_all(@places)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment