|
|
|
|
@ -116,16 +116,20 @@ module FiltersHelper
|
|
|
|
|
user.support? || org.stock_owners.count > 1 || (org.holds_own_stock? && org.stock_owners.count.positive?) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def show_needstype_filter? |
|
|
|
|
[1,2].all?{ |needstype| current_user.lettings_logs.where(needstype:).count.positive? } && request.path.include?("/lettings-logs") |
|
|
|
|
def has_logs_for_both_needstypes? |
|
|
|
|
[1, 2].all? { |needstype| current_user.lettings_logs.where(needstype:).count.positive? } |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def show_owning_org_filter? |
|
|
|
|
(current_user.support? || current_user.organisation.stock_owners.count > 1) && request.path == "/lettings-logs" |
|
|
|
|
def multiple_owning_orgs? |
|
|
|
|
current_user.support? || current_user.organisation.stock_owners.count > 1 |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def show_managing_org_filter? |
|
|
|
|
(current_user.support? || current_user.organisation.managing_agents.count > 1) && request.path == "/lettings-logs" |
|
|
|
|
def multiple_managing_orgs? |
|
|
|
|
current_user.support? || current_user.organisation.managing_agents.count > 1 |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def user_or_org_lettings_path? |
|
|
|
|
request.path.include?("/lettings-logs") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|