demarches-normaliennes/app/views/backoffice/dossiers/_list.html.haml
2017-04-20 10:35:53 +02:00

70 lines
3.4 KiB
Text

%table#dossiers-list.table
%thead
- if smart_listing.name.to_s == 'follow_dossiers'
%th.col-xs-1.center
%i.fa.fa-bell
%th.col-xs-1
État
- @facade_data_view.preference_list_dossiers_filter.each do |preference|
- unless preference.libelle == 'Statut' || preference.libelle == 'État'
%th{ class: "col-md-#{preference.bootstrap_lg} col-lg-#{preference.bootstrap_lg}" }
- if preference.table.to_s.include? 'champs'
= preference.libelle
- else
= smart_listing.sortable preference.libelle, preference.table_attr
- if @facade_data_view.active_filter? preference
%i.filter.fa.fa-filter{ style: "color: #{(preference.filter.blank? ? 'grey' : 'orange')}", id: "filter_#{smart_listing.name.to_s}_#{preference.table_attr.sub('.', '_')}" }
= render partial: 'backoffice/dossiers/filter_framed', locals: { preference: preference, filter_framed_id: "framed_filter_#{smart_listing.name.to_s}_#{preference.table_attr.sub('.', '_')}" }
%th.col-xs-1.center Actions
%th.col-xs-1.center Abonnés
- unless smart_listing.empty?
- smart_listing.collection.each do |dossier|
%tr.dossier-row{ id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: dossier.id) }
- if smart_listing.name.to_s == 'follow_dossiers'
%td.col-xs-1.center
- total_notif = dossier.notifications.where(already_read: false).count
- if total_notif == 0
.badge.progress-bar-default
= total_notif
- else
.badge.progress-bar-warning
= total_notif
%td.col-xs-1
= dossier.decorate.display_state
- @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index|
- unless preference.libelle == 'Statut' || preference.libelle == 'État'
%td
- if preference.table.nil? || preference.table.empty?
- value = dossier.decorate.public_send(preference.attr_decorate)
- elsif preference.table == 'champs'
- value = dossier.champs.find_by_type_de_champ_id(preference.attr).value rescue nil
- elsif preference.table == 'champs_private'
- value = dossier.champs_private.find_by_type_de_champ_id(preference.attr).value rescue nil
- else
- begin
- value = dossier.public_send(preference.table).decorate.public_send(preference.attr_decorate)
- rescue NoMethodError
- value = ''
= value
%td.center
- if current_gestionnaire.follow?(dossier.id)
= link_to('Quitter'.html_safe, backoffice_dossier_follow_path(dossier_id: dossier.id), 'data-method' => :put, class: 'btn-sm btn-danger', id: "suivre_dossier_#{dossier.id}")
- else
= link_to('Suivre', backoffice_dossier_follow_path(dossier_id: dossier.id), 'data-method' => :put, class: 'btn-sm btn-primary', id: "suivre_dossier_#{dossier.id}")
%td.center{ style: "color: #{dossier.total_follow == 0 ? 'red' : ''}" }
= dossier.total_follow
= smart_listing.paginate
- if smart_listing.name.to_s == 'follow_dossiers' && smart_listing.collection.count > 0
= smart_listing.pagination_per_page_links
%br
- if smart_listing.empty?
%h4.center
Aucun dossier