%h1 Who profits from WestConnex?
%p.lede
  These #{@contractors.count} companies have been contracted by the NSW Government.
  So far, their #{pluralize(Contract.count, "contracts")} are worth #{number_to_currency(Contract.sum(:value), precision: 0)}.
%ul.contractors
  - @contractors.each do |contractor|
    %li.contractor
      %header
        %h2.contractor-name= contractor.name
        %span.contractor-value= number_to_currency(contractor.total_est_contract_value, precision: 0)
        .contractor-data
          - if contractor.website
            %p= link_to simple_url(contractor.website), contractor.website, class: 'contractor-website'
      %ul.contracts
        - contractor.contracts.each do |contract|
          %li.contract
            %p.contract-description
              = link_to(contract.description, contract.url, title: "View the contract listing at tenders.gov.nsw")
            .item-data
              %dl.item-data-group
                %dt Value:
                %dd.contract-value #{number_to_currency(contract.value, precision: 0)}
              %dl.item-data-group
                %dt Period:
                %dd.contract-duration #{contract.start_date} – #{contract.end_date}

%h1 Who profits from WestConnex?
%p.lede
  These #{@contractors.count} companies have been contracted by the NSW Government.
  So far, their #{pluralize(Contract.count, "contracts")} are worth #{number_to_currency(Contract.sum(:value), precision: 0)}.
%ul.contractors
  - @contractors.each do |contractor|
    %li.contractor
      %header
        %h2.contractor-name= contractor.name
        %span.contractor-value= number_to_currency(contractor.total_est_contract_value, precision: 0)
        .contractor-data
          - # TODO change to generic item data group class
          - if contractor.acn
            %dl.item-data-group
              %dt ACN
              %dd= contractor.acn
          - if contractor.abn
            %dl.item-data-group
              %dt ABN
              %dd= contractor.abn
          - if contractor.website
            %dl.item-data-group
              %dt Website
              %dd= link_to simple_url(contractor.website), contractor.website, class: 'contractor-website'
      %ul.contracts
        - contractor.contracts.each do |contract|
          %li.contract
            %p.contract-description
              = link_to(contract.description, contract.url, title: "View the contract listing at tenders.gov.nsw")
            .item-data
              %dl.item-data-group
                %dt Value:
                %dd.contract-value #{number_to_currency(contract.value, precision: 0)}
              %dl.item-data-group
                %dt Period:
                %dd.contract-duration #{contract.start_date} – #{contract.end_date}

Add acn and abn details
Add acn and abn details
