spielhoelle/zelos

View on GitHub
app/views/admin/entries/index.html.haml

Summary

Maintainability
Test Coverage
- if @entries.any?
  .row
    #entries_tree
      -# - if params[:search].blank?
      .row.hide-on-med-and-down.mt-2.center
        .col.s3
          %h5 Invoices per month
          = column_chart Entry.visible.group_by_month(:delivery_date, format: "%m").count, colors: ["#ffeb3b"]
        .col.s2
          %h5 Invoices per year
          = column_chart Entry.visible.group_by_year(:delivery_date, format: "%Y").count, colors: ["#27ae60"]
        .col.s2
          %h5 Customer this year
          = column_chart @this_year.visible.order(:delivery_date).reverse.collect { |x| [x.customer.name, get_items_total(x)] }, colors: ["#F44336"]
        .col.s3
          %h5 All customers
          = column_chart @data2, stacked: true, legend: false
        .col.s2
          %h5 Still open
          = pie_chart Entry.where.not("is_offer", true).where("status" => "open").collect { |x| [x.customer.company, get_items_total(x)] }, legend: false, donut: true

      = render "entries_tree"
- else
  %h2.grey-text.text-lighten-1.center-align.mt-5
    %div
      %i.material-icons.large.grey-text.text-lighten-1 child_care
    =t('all_good')


.fixed-action-btn
  = link_to new_admin_entry_path, class: "btn-floating waves-effect waves-light green btn-large" do
    %i.new_button.material-icons.large add
  %ul
    %li
      = link_to new_admin_entry_path(:is_offer => true), class: "btn-floating waves-effect waves-light red" do
        %i.material-icons question_answer