isprambiente/medplan

View on GitHub
app/views/home/_filters.html.haml

Summary

Maintainability
Test Coverage
= form_with scope: 'filter', url: home_list_path, method: :get, data: { turbo_frame: 'users', controller: 'form' } do |f|
  %a.button.is-danger.is-fullwidth.mb-4{ href: root_path, data: { turbo_frame: 'yield' } } Rimuovi tutti i filtri

  %nav.panel.filters
    %p.panel-heading= fas_icon('list', text: t('box', scope: 'home.index'))
    %label.panel-block
      = f.radio_button :riepilogo, 'new', data: {action: "form#send"}
      %span= t('new', scope: 'home.index.filter')
      %span.tag.is-rounded.is-to-right= @users.unassigned.count
    %label.panel-block
      = f.radio_button :riepilogo, 'expired', data: {action: "form#send"}, checked: true
      %span= t('expired', scope: 'home.index') + " " + l(@start_at, :format => '%B %Y').capitalize
      %span.tag.is-rounded.is-to-right= @users.where('audits.expire < ? ', @start_at).count
    %label.panel-block
      = f.radio_button :riepilogo, 'thismonth', data: {action: "form#send"}
      %span= t('expire_at', scope: 'home.index')+"#{l(@start_at, :format => '%B %Y').capitalize}"
      %span.tag.is-rounded.is-to-right= @users.where('audits.expire Between ? And ?', @start_at, @stop_at).count
    %label.panel-block
      = f.radio_button :riepilogo, 'nextmonth', data: {action: "form#send"}
      %span= t('expire_at', scope: 'home.index')+"#{l(@next_start_at, :format => '%B %Y').capitalize} (+1 "+t('month', scope: '')+")"
      %span.tag.is-rounded.is-to-right= @users.where('audits.expire Between ? And ?', @next_start_at, @next_stop_at).count
    %label.panel-block
      = f.radio_button :riepilogo, 'next2months', data: {action: "form#send"}
      %span= t('expire_at', scope: 'home.index')+"#{l(@next_2_start_at, :format => '%B %Y').capitalize} (+2 "+t('months', scope: '')+")"
      %span.tag.is-rounded.is-to-right= @users.where('audits.expire Between ? And ?', @next_2_start_at, @next_2_stop_at).count
    %label.panel-block
      = f.radio_button :riepilogo, 'locked', data: {action: "form#send"}
      %span= t('locked', scope: 'home.index.filter')
      %span.tag.is-rounded.is-to-right= @users.locked.count
    %label.panel-block
      = f.radio_button :riepilogo, 'blocked', data: {action: "form#send"}
      %span= t('blocked', scope: 'home.index.filter')
      %span.tag.is-rounded.is-to-right= @users.blocked.count

  %nav.panel.filters
    %p.panel-heading= fas_icon('calendar', text: t('event_waiting', scope: 'event'))
    .panel-block
      %a.button.is-small.is-warning.is-fullwidth{ href: home_meetings_path, data: { turbo_frame: 'meetings' }}= fas_icon( 'spinner', text: t('refresh') )
    = turbo_frame_tag 'meetings', class: 'rows', src: home_meetings_path, alt: 'Nessuna riga trovata' do
      .loading.has-text-centered= fas_icon 'cog fa-pulse', text: 'Caricamento in corso'

  %nav#cities.panel.filters
    %p.panel-heading= fas_icon('map-marker', text: t('city', scope: 'user'))
    %label.panel-block
      = f.radio_button :city, '', data: {action: "form#send"}
      %span= t('all', scope: '')
    - User.cities.each do |city|
      %label.panel-block{class: [city[0],'sedi']}
        = f.radio_button :city, city[0], data: {action: "form#send"}
        %span= t(city[0], scope: 'user.cities')

  %nav#positions.panel.filters
    %p.panel-heading= fas_icon('building', text: t('position', scope: 'user'))
    %label.panel-block{class: 'sedi'}
      = f.radio_button :postazione, '', selected: 'selected', data: {action: "form#send"}
      %span= t('all')
    - User.postaziones.each do |postazione|
      %label.panel-block{class: [postazione[0],'sedi']}
        = f.radio_button :postazione, postazione[0], data: {action: "form#send"}
        %span= t(postazione[0], scope: 'user.positions')