anthonymidili/EasyKeep

View on GitHub
app/views/accounts/_table.html.haml

Summary

Maintainability
Test Coverage
.scroll_overflow-x
  %table
    %thead
      %tr
        %th= 'Account'.pluralize(@accounts.count)
        %th Contact name
        %th Contact info
        %th All services invoiced
        %th All invoices P.I.F.
        %th User status
        %th Edit
        - if current_user.is_owner?
          %th Destroy
    %tbody
      - @accounts.each do |account|
        %tr
          %td= link_to account.name, account
          %td= account.user.name
          %td.center_cell
            %button.to_link{data: { open: "contactInfoModal#{account.id}" }}
              %i.fas.fa-envelope
          %td{class: "no_action_required_#{account.all_services_invoiced?}"}
            = invoiceable_or_not(account)
          %td{class: "no_action_required_#{account.paid_in_full?}"}
            = pif_or_outstanding(account)
          %td.center_cell= render 'accounts/user_status', account: account
          %td.center_cell
            = link_to edit_account_path(account) do
              %i.fas.fa-edit
          - if current_user.is_owner?
            %td.center_cell
              = link_to account, class: 'red_link', method: :delete, data: { confirm: t(:confirm_delete_account) }  do
                %i.fas.fa-trash
        = render 'accounts/contact_info_modal', account: account