Class: Renalware::Letters::UnreadElectronicCCsComponent

Inherits:
ApplicationComponent show all
Includes:
Pundit::Helper
Defined in:
app/components/renalware/letters/unread_electronic_ccs_component.rb

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#policy, #renalware

Instance Method Details

#unread_electronic_ccsObject



10
11
12
13
14
15
16
17
18
19
# File 'app/components/renalware/letters/unread_electronic_ccs_component.rb', line 10

def unread_electronic_ccs
  @unread_electronic_ccs ||= begin
    receipts = Letters::ElectronicReceipt
      .includes(letter: [:patient, :author, :letterhead])
      .unread
      .for_recipient(current_user.id)
      .order(created_at: :asc)
    CollectionPresenter.new(receipts, Letters::ElectronicReceiptPresenter)
  end
end