Force state dossier in files lists on gestionnaire board

This commit is contained in:
Xavier J 2017-01-05 18:01:53 +01:00
parent b48726427d
commit ab02fe48c3
3 changed files with 35 additions and 24 deletions

View file

@ -22,6 +22,10 @@ class DossiersListFacades
current_devise_profil.dossiers.where(archived: false).count
end
def total_dossier_follow
@current_devise_profil.dossiers_follow.count
end
def total_new_dossier
current_devise_profil.dossiers.where(state: :initiated, archived: false).count
end

View file

@ -1,17 +1,21 @@
%table#dossiers_list.table
%thead
- if smart_listing.name.to_s == 'follow_dossiers'
%th
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
%i.fa.fa-bell
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
État
- @facade_data_view.preference_list_dossiers_filter.each do |preference|
%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('.', '_')}"}
- 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-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center Actions
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center Abonnés
@ -20,7 +24,7 @@
- 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.center
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
- total_notif = dossier.notifications.where(already_read: false).count
- if total_notif == 0
.badge.progress-bar-default
@ -28,21 +32,24 @@
- else
.badge.progress-bar-warning
= total_notif
%td.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1
= dossier.decorate.display_state
- @facade_data_view.preference_list_dossiers_filter.each_with_index do |preference, index|
%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
- elsif preference.table == 'champs_private'
- value = dossier.champs_private.find_by_type_de_champ_id(preference.attr).value
- else
- begin
- value = dossier.public_send(preference.table).decorate.public_send(preference.attr_decorate)
- rescue NoMethodError
- value = ''
- 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
- elsif preference.table == 'champs_private'
- value = dossier.champs_private.find_by_type_de_champ_id(preference.attr).value
- else
- begin
- value = dossier.public_send(preference.table).decorate.public_send(preference.attr_decorate)
- rescue NoMethodError
- value = ''
= value
= value
%td.center
- if current_gestionnaire.follow?(dossier.id)

View file

@ -1,6 +1,6 @@
%div#first-block
%div.dossiers-en-cours
.count= @facade_data_view.total_dossier
.count= @facade_data_view.total_dossier_follow
.text= "SUIVIS"
%div.nouveaux-dossiers
.count= @facade_data_view.total_new_dossier