= wicked_pdf_stylesheet_link_tag "mail/all"


%table{:width => "100%"}
  %tbody
    %tr{ valign: "top" }
      %td{ :align => "left" }
        %h4
          = t :tax_invoice
      - if @order.distributor.display_invoice_logo? && @order.distributor.logo.present?
        %td{ :align => "right", rowspan: 2 }
          = wicked_pdf_image_tag @order.distributor.logo(:small), width: 150, height: 150
    %tr{ valign: "top" }
      %td{ :align => "left" }
        %strong= @order.distributor.name
        %br
        = @order.distributor.address.address_part1
        %br
        = @order.distributor.address.address_part2
        %br
        = @order.distributor.email_address
        - if @order.distributor.phone.present?
          %br
          = @order.distributor.phone
        - if @order.distributor.abn.present?
          %br
          = "#{t :abn} #{@order.distributor.abn}"
        - if @order.distributor.acn.present?
          %br
          = "#{t :acn} #{@order.distributor.acn}"
    %tr{ valign: "top" }
      %td{ :align => "left", colspan: 2 } &nbsp;
    %tr{ valign: "top" }
      %td{ :align => "left" }
        %br
        = t :invoice_issued_on
        = l Time.zone.now.to_date
        %br
        = t :date_of_transaction
        = l @order.completed_at.to_date
        %br
        = t :order_number
        = @order.number
      %td{ :align => "right" }
        = t :invoice_billing_address
        %br
        %strong= @order.bill_address.full_name
        - if @order.andand.customer.andand.code.present?
          %br
          = "Code: #{@order.customer.code}"
        %br
        = @order.bill_address.address_part1
        %br
        = @order.bill_address.address_part2

= render 'spree/admin/orders/invoice_table2'

- if @order.special_instructions.present?
  %p.callout
    %strong
      = t :customer_instructions
  %p
    %em= @order.special_instructions
  %p
    &nbsp;

- if @order.distributor.invoice_text.present?
  %p
    = @order.distributor.invoice_text

= render 'spree/order_mailer/payment'
