Add badge for new files in procedure list for gestionnaire

This commit is contained in:
Xavier J 2016-12-27 11:06:09 +01:00
parent 2e13cb6818
commit e37012dce6
2 changed files with 10 additions and 1 deletions

View file

@ -26,6 +26,10 @@ class DossiersListFacades
current_devise_profil.dossiers.where(state: :initiated, archived: false).count
end
def new_dossier_number procedure_id
current_devise_profil.dossiers.where(state: :initiated, archived: false, procedure_id: procedure_id).count
end
def gestionnaire_procedures_name_and_id_list
@current_devise_profil.procedures.order('libelle ASC').inject([]) { |acc, procedure| acc.push({id: procedure.id, libelle: procedure.libelle, unread_notifications: @current_devise_profil.notifications_for(procedure)}) }
end

View file

@ -17,6 +17,11 @@
= link_to backoffice_dossiers_procedure_path(procedure[:id]), {title: procedure[:libelle]} do
%div.procedure_list_element{ class: ('active' if procedure[:id] == @facade_data_view.procedure.id rescue '') }
= truncate(procedure[:libelle], length: 50)
- total_new = @facade_data_view.new_dossier_number procedure[:id]
- if total_new > 0
.badge.progress-bar-success{title:'Nouveaux dossiers'}
= total_new
-if procedure[:unread_notifications] > 0
.badge.progress-bar-warning
.badge.progress-bar-warning{title: 'Notifications'}
= procedure[:unread_notifications]