Commit 99c143c2 authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Show only service types related to the current service place in the shifts home page combo box


Signed-off-by: Bruno Freitas Tissei's avatarBruno Freitas Tissei <bft15@inf.ufpr.br>
parent be29d8f1
......@@ -360,10 +360,16 @@ class ProfessionalsController < ApplicationController
# GET /professionals/minhas_escalas
def shifts
#TODO Tem que fazer [by Fabricio]
@service_places_professionals = ServiceType.all.order(:description)
if @currentProfessionalServicePlace.role == "adm_c3sl"
@service_places_professionals = ServiceType.all.order(:description)
else
ids = ServiceTypeServicePlace.where(service_place_id: @currentProfessionalServicePlace.service_place.id).pluck(:service_type_id)
@service_places_professionals = ServiceType.where(id: ids)
end
if session[:carrega_pagina]
@carrega_pagina = true
session[:carrega_pagina] = false
@carrega_pagina = true
session[:carrega_pagina] = false
end
@link = "Minhas Escalas"
......
......@@ -681,7 +681,7 @@ class ShiftsController < ApplicationController
def load_professionals_and_service_types
@place_service_types = ServiceType.active
if @currentProfessionalServicePlace.role != "adm_c3sl"
@service_places_professionals = Professional.where(service_places: {city_hall_id: @currentCityHall.id}).includes(:service_places).hide_c3sl_user.order('name ASC')
@service_places_professionals = Professional.where(service_places: {city_hall_id: @currentCityHall.id}).includes(:service_places).hide_c3sl_user
@city_halls = CityHall.where(id: @currentCityHall.id).order('name ASC');
else
# mostrar apenas profissionais ativos
......
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