spielhoelle/zelos

View on GitHub
app/views/admin/summaries/_tree.html.haml

Summary

Maintainability
Test Coverage
.row.hide-on-med-and-down.mt-2
  .col.s6
    %h5 Invoices per year 
    = column_chart Entry.visible.group_by_year(:delivery_date).count, colors: ["#27ae60"]
  .col.s6
    %h5 Bills per year 
    = column_chart Bill.group_by_year(:bill_date).count, colors: ["#F44336"]
  -#.col.s4
    -#- bla = Entry.visible.group_by_year(:delivery_date)

    -#- networth_data = [ {name: "Assets", data: {"NetWorth": 6979.53}}, {name: "Liabilities", data: {"NetWorth": 10532.32}} ]

    -#- networth_data = []
    -#- binding.pry
    -#- bla.each do |year|
      -#- networth_data << { {name: year, data: {"Money": 6979.53}}, {name: "Liabilities", data: {"Money": 10532.32}} }
    
    -#= column_chart networth_data, colors: ["green", "#FF0000"], library: {backgroundColor: "#FFF", height: 500}
%hr
%table.highlight
  %thead.no-border
    %tr
      %th.hide-on-med-and-down Year
      %th.hide-on-med-and-down Income
      %th.hide-on-med-and-down Bills
      %th.hide-on-med-and-down Profit
      %th.hide-on-med-and-down Taxes

  %tbody
    -@total.each_with_index do |year, index|
      %tr
        %td
          = year[:year]
        %td
          %span.green-text= money_helper( year[:entries])
        %td
          - if year[:bills].present?
            %span.red-text= money_helper( year[:bills] )
        %td
          = money_helper( year[:entries] - year[:bills] ) 
        %td

          .btn.btn-sm.px-1
            = "#{ year[:taxes][:consultant] }"
            %i.material-icons
              local_library  
          .btn.btn-sm.px-1
            = "#{ year[:taxes][:without_consultant] }"
            %i.material-icons
              code  
          = money_helper(year[:taxes][:taxes])
          %span.red-text.right
            Taxes: 
            = money_helper(year[:taxes][:taxes] / 100 * 19)