Commit 3974fc29 authored by Matheus Horstmann's avatar Matheus Horstmann 🐴

Issue#134: Add some erro message but now its possible schedule even if city is inactive

parent 2d85873e
......@@ -22,10 +22,16 @@ class SchedulesController < ApplicationController
# GET /schedules
# GET /schedules.json
def index
if !@citizen.nil?
if !CityHall.where(city_id: @citizen.city_id).first.active?
@form_error = "O cidadão pertence a uma cidade inativa! :("
end
end
if @citizen.nil? and params[:cpf]
@form_error = "O CPF digitado é inválido ou o cidadão não foi cadastrado!"
end
if params[:clear_cpf]
session[:cpf] = nil unless session[:cpf].nil?
end
......@@ -110,7 +116,7 @@ class SchedulesController < ApplicationController
if @currentProfessionalServicePlace.role == "adm_c3sl"
# As adm_c3sl
# Get all active sectors
if(@citizen != nil)
if(@citizen != nil and CityHall.where(city_id: @citizen.city_id).first.active?)
@city_hall_id = CityHall.active.where(city_id: @citizen.city.id).first.id
@sectors = Sector.active.where(city_hall_id: @city_hall_id)
else
......
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