Ajust count notification for procedure left panel in back office gestionnaire
This commit is contained in:
parent
70fcaf281f
commit
c122a64237
4 changed files with 17 additions and 9 deletions
|
@ -31,7 +31,7 @@ class DossiersListFacades
|
||||||
end
|
end
|
||||||
|
|
||||||
def gestionnaire_procedures_name_and_id_list
|
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)}) }
|
@current_devise_profil.procedures.order('libelle ASC').inject([]) { |acc, procedure| acc.push({id: procedure.id, libelle: procedure.libelle, unread_notifications: @current_devise_profil.dossier_with_notification_for(procedure)}) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def unread_notifications
|
def unread_notifications
|
||||||
|
|
|
@ -79,6 +79,18 @@ class Gestionnaire < ActiveRecord::Base
|
||||||
0
|
0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def dossier_with_notification_for procedure
|
||||||
|
procedure_ids = dossiers_follow.pluck(:procedure_id)
|
||||||
|
|
||||||
|
if procedure_ids.include?(procedure.id)
|
||||||
|
return dossiers_follow.where(procedure_id: procedure.id)
|
||||||
|
.inject(0) do |acc, dossier|
|
||||||
|
acc += ((dossier.notifications.where(already_read: false).count) > 0 ? 1 : 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
0
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def valid_couple_table_attr? table, column
|
def valid_couple_table_attr? table, column
|
||||||
|
|
|
@ -6,13 +6,8 @@
|
||||||
.count= @facade_data_view.total_new_dossier
|
.count= @facade_data_view.total_new_dossier
|
||||||
.text= "NOUVEAUX"
|
.text= "NOUVEAUX"
|
||||||
%div.nouvelles-notifications
|
%div.nouvelles-notifications
|
||||||
- new_notifications = @facade_data_view.dossiers_with_unread_notifications.count
|
.count= @facade_data_view.dossiers_with_unread_notifications.count
|
||||||
- if new_notifications > 1
|
.text= "MODIFIÉS"
|
||||||
.count= new_notifications
|
|
||||||
.text= "MODIFIÉS"
|
|
||||||
- elsif new_notifications == 1
|
|
||||||
.count 1
|
|
||||||
.text= "MODIFIÉ"
|
|
||||||
|
|
||||||
%div#action-block
|
%div#action-block
|
||||||
|
|
||||||
|
|
|
@ -14,5 +14,6 @@
|
||||||
= h @dossier.procedure.description.html_safe
|
= h @dossier.procedure.description.html_safe
|
||||||
|
|
||||||
- else
|
- else
|
||||||
= image_tag(image_url(LOGO_NAME), {id: 'logo_tps'})
|
#logo_procedure.flag
|
||||||
|
= image_tag(image_url(LOGO_NAME), {id: 'logo_tps'})
|
||||||
%br
|
%br
|
Loading…
Reference in a new issue