= wicked_pdf_stylesheet_link_tag "mail/all"

%table{:width => "100%"}
  %tbody
    %tr{ valign: "top" }
      %td{ :align => "left", colspan: 3 }
        %h6
          = "#{t('.issued_on')}: "
          = l Time.zone.now.to_date
    %tr{ valign: "top" }
      %td{ :align => "left" }
        %h4
          = "#{t('.tax_invoice')}: "
          = "#{@order.number}"
      %td{width: "10%" }
        &nbsp;
      %td{ :align => "right" }
        %h4= @order.order_cycle.andand.name
    %tr{ valign: "top" }
      %td{ :align => "left" }
        %strong= "#{t('.from')}: #{@order.distributor.name}"
        - if @order.distributor.abn.present?
          %br
          = "#{t(:abn)} #{@order.distributor.abn}"
        %br
        = @order.distributor.address.full_address
        %br
        = @order.distributor.contact.email
      %td{width: "10%" }
        &nbsp;
      %td{ :align => "right" }
        %strong= "#{t('.to')}: #{@order.ship_address.full_name}"
        - if @order.andand.customer.andand.code.present?
          %br
          = "#{t('.code')}: #{@order.customer.code}"
        %br
        = @order.ship_address.full_address
        %br
        - if @order.andand.customer.andand.email.present?
          = "#{@order.customer.email},"
        = "#{@order.bill_address.phone}"

= render 'spree/admin/orders/invoice_table'

- 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'
