- if customer.subscriptions.present? .card.my-4 .card-header Subscriptions .card-body %table.table %thead %tr %th Subscribed %th Quantity %th Interval %tbody - customer.subscriptions.each do |sub| %tr %td= sub.subscribable %td= sub.quantity %td= sub.interval - if customer.invoices.present? .card.my-4 .card-header Invoices .card-body %table.table %thead %tr %th Date %th Invoice %th Total %tbody - customer.invoices.each do |invoice| - date_method = [(:date if invoice.respond_to?(:date)), (:period_start if invoice.respond_to?(:period_start)), :created].compact.first %tr %td= link_to Time.zone.at(invoice.public_send(date_method)).strftime('%F'), invoice.invoice_pdf %td %p = invoice.number %br = Time.zone.at(invoice.lines.first.period.start).strftime('%F') to = Time.zone.at(invoice.lines.first.period.end).strftime('%F') %p - invoice.lines.each do |line| = line.description %br %td= price_to_currency(invoice.total) - if customer.upcoming_invoice.present? - invoice = customer.upcoming_invoice - date_method = [(:date if invoice.respond_to?(:date)), (:period_start if invoice.respond_to?(:period_start)), :created].compact.first .card.my-4 .card-header Upcoming Invoice .card-body %table.table %tbody %tr %th Date %td= Time.zone.at(invoice.public_send(date_method)).strftime('%F') %tr %th Items %td %table.table %tbody - invoice.lines.each do |line| %tr %td #{Time.zone.at(line.period.start).strftime('%F')} to #{Time.zone.at(line.period.end).strftime('%F')} %td= line.description %td= price_to_currency(line.amount) %tr %th Total %td= price_to_currency(customer.upcoming_invoice.total)