Commit 32e029eb authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Merge branch 'master' of gitlab.c3sl.ufpr.br:agendador/agendador

parents 0740a4ec 5bb28aa8
......@@ -156,7 +156,7 @@ class ServicePlacesController < ApplicationController
if @service_place
# As duas atribuições abaixo correspondem à solução encontrada em:
# http://meltingice.net/2013/06/11/pluck-multiple-columns-rails/
@orgao_profissionais = @service_place.professionals
@orgao_profissionais = @service_place.professionals.order('name ASC')
.active
.hide_c3sl_user
.select([:id, :name])
......
......@@ -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)
......
......@@ -31,10 +31,10 @@
<%= f.label :service_place_id, t(:service_place)+"*:" %><br />
<% if params[:shift] %>
<% if @currentProfessionalServicePlace.role == "adm_c3sl" %>
<%= f.collection_select :service_place_id, ServicePlace.active, :id, :name_with_city_hall,
<%= f.collection_select :service_place_id, ServicePlace.active.order('name ASC'), :id, :name_with_city_hall,
{ :selected => params[:shift][:service_place_id], :include_blank => 'Selecione um '+t(:service_place)}%>
<% elsif @currentProfessionalServicePlace.role == "adm_prefeitura" %>
<%= f.collection_select :service_place_id, @currentCityHall.service_places, :id, :name,
<%= f.collection_select :service_place_id, @currentCityHall.service_places.sort {|a, b| a.name <=> b.name}, :id, :name,
{ :selected => params[:shift][:service_place_id], :include_blank => 'Selecione um '+ t(:service_place)}%>
<% else %>
<%= f.collection_select :service_place_id, [@currentProfessionalServicePlace.service_place], :id, :name,
......@@ -42,10 +42,10 @@
<% end %>
<% else %>
<% if @currentProfessionalServicePlace.role == "adm_c3sl" %>
<%= f.collection_select :service_place_id, ServicePlace.active, :id, :name_with_city_hall,
<%= f.collection_select :service_place_id, ServicePlace.active.order('name ASC'), :id, :name_with_city_hall,
{ :include_blank => 'Selecione um '+ t(:service_place)}%>
<% elsif @currentProfessionalServicePlace.role == "adm_prefeitura" %>
<%= f.collection_select :service_place_id, @currentCityHall.service_places, :id, :name,
<%= f.collection_select :service_place_id, @currentCityHall.service_places.sort {|a, b| a.name <=> b.name}, :id, :name,
{ :include_blank => 'Selecione um '+ t(:service_place)}%>
<% else %>
<%= f.collection_select :service_place_id, [@currentProfessionalServicePlace.service_place], :id, :name,
......
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