|
|
|
@ -3,22 +3,21 @@ class MissingStockOwnersBannerComponent < ViewComponent::Base |
|
|
|
|
|
|
|
|
|
|
|
attr_reader :user, :organisation |
|
|
|
attr_reader :user, :organisation |
|
|
|
|
|
|
|
|
|
|
|
def initialize(user:) |
|
|
|
def initialize(user:, organisation: nil) |
|
|
|
@user = user |
|
|
|
@user = user |
|
|
|
@organisation = user.organisation |
|
|
|
@organisation = organisation || user.organisation |
|
|
|
|
|
|
|
|
|
|
|
super |
|
|
|
super |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def display_banner? |
|
|
|
def display_banner? |
|
|
|
return false if user.support? |
|
|
|
|
|
|
|
return false if DataProtectionConfirmationBannerComponent.new(user:, organisation:).display_banner? |
|
|
|
return false if DataProtectionConfirmationBannerComponent.new(user:, organisation:).display_banner? |
|
|
|
|
|
|
|
|
|
|
|
!organisation.holds_own_stock? && organisation.stock_owners.empty? && organisation.absorbed_organisations.empty? |
|
|
|
!organisation.holds_own_stock? && organisation.stock_owners.empty? && organisation.absorbed_organisations.empty? |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def header_text |
|
|
|
def header_text |
|
|
|
if user.data_coordinator? |
|
|
|
if user.data_coordinator? || user.support? |
|
|
|
"Your organisation does not own stock. You must #{add_stock_owner_link} before you can create logs.".html_safe |
|
|
|
"Your organisation does not own stock. You must #{add_stock_owner_link} before you can create logs.".html_safe |
|
|
|
else |
|
|
|
else |
|
|
|
"Your organisation does not own stock. You must add a stock owner before you can create logs.".html_safe |
|
|
|
"Your organisation does not own stock. You must add a stock owner before you can create logs.".html_safe |
|
|
|
@ -26,7 +25,7 @@ class MissingStockOwnersBannerComponent < ViewComponent::Base |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def banner_text |
|
|
|
def banner_text |
|
|
|
if user.data_coordinator? |
|
|
|
if user.data_coordinator? || user.support? |
|
|
|
"If your organisation does own stock, #{contact_helpdesk_link} to update your details.".html_safe |
|
|
|
"If your organisation does own stock, #{contact_helpdesk_link} to update your details.".html_safe |
|
|
|
else |
|
|
|
else |
|
|
|
"Ask a data coordinator to add a stock owner. Find your data coordinators on the #{users_link}.</br> |
|
|
|
"Ask a data coordinator to add a stock owner. Find your data coordinators on the #{users_link}.</br> |
|
|
|
|