Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

44 lines
982 B

class CreateLogActionsComponent < ViewComponent::Base
include Rails.application.routes.url_helpers
attr_reader :bulk_upload, :user, :log_type
def initialize(user:, log_type:, bulk_upload: nil)
@bulk_upload = bulk_upload
@user = user
@log_type = log_type
super
end
def display_actions?
return false if bulk_upload.present?
return true if user.support?
user.organisation.data_protection_confirmed? && user.organisation.organisation_or_stock_owner_signed_dsa_and_holds_own_stock?
end
def create_button_copy
"Create a new #{log_type} log"
end
def create_button_href
send("#{log_type}_logs_path")
end
def upload_button_copy
"Upload #{log_type} logs in bulk"
end
def upload_button_href
send("bulk_upload_#{log_type}_log_path", id: "start")
end
def view_uploads_button_copy
"View #{log_type} bulk uploads"
end
def view_uploads_button_href
send("bulk_uploads_#{log_type}_logs_path")
end
end