Commit 8dabb797 authored by Matheus Horstmann's avatar Matheus Horstmann 🐴

Issue#133: Change to show all service places from a city hall when current user is adm_prefeitura

parent 2d85873e
ruby 2.2.0p0
ruby 2.3.0
......@@ -459,8 +459,12 @@ class ReportsController < ApplicationController
@schedules = @search.result.to_sql
@search.build_sort
if !current_citizen.professional.administradorc3sl?
@serviceplaces = ServicePlace.all.active.where(:city_hall_id => @currentCityHall.id, :id => @currentProfessionalServicePlace.service_place_id).order('name ASC')
if @currentProfessionalServicePlace.role != 'adm_c3sl'
if @currentProfessionalServicePlace.role == 'adm_prefeitura'
@serviceplaces = ServicePlace.active.where(:city_hall_id => @currentCityHall.id).order('name ASC')
else
@serviceplaces = ServicePlace.active.where(:city_hall_id => @currentCityHall.id, :id => @currentProfessionalServicePlace.service_place_id).order('name ASC')
end
@professionals = Professional.active.hide_c3sl_user.where(service_places: {city_hall_id: @currentCityHall.id}).includes(:service_places)
else
@serviceplaces = ServicePlace.all.order('name ASC')
......@@ -670,8 +674,12 @@ class ReportsController < ApplicationController
@link = "Relatórios"
@link2 = "Atendimentos"
if !current_citizen.professional.administradorc3sl?
@serviceplaces = ServicePlace.all.where(:city_hall_id => @currentCityHall.id, :id => @currentProfessionalServicePlace.service_place_id).order('name ASC')
if @currentProfessionalServicePlace.role != 'adm_c3sl'
if @currentProfessionalServicePlace.role == 'adm_prefeitura'
@serviceplaces = ServicePlace.all.where(:city_hall_id => @currentCityHall.id).order('name ASC')
else
@serviceplaces = ServicePlace.all.where(:city_hall_id => @currentCityHall.id, :id => @currentProfessionalServicePlace.service_place_id).order('name ASC')
end
@professionals = Professional.active.hide_c3sl_user.where(service_places: {city_hall_id: @currentCityHall.id}).includes(:service_places)
else
@serviceplaces = ServicePlace.all
......
......@@ -14,7 +14,7 @@
<br>
<% if @currentProfessionalServicePlace.role != "adm_c3sl"%>
<% if @currentProfessionalServicePlace.role != "adm_c3sl" and @currentProfessionalServicePlace.role != "adm_prefeitura" %>
<div class="field-h col s12 m4 l4">
<%= f.label :service_place_id, t(:service_place) + ":" %><br />
<%= f.text_field :service_place_id_eq, { :class => 'search-field', :value => @serviceplaces[0].name, :disabled => true} %>
......
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