List dossiers archived

This commit is contained in:
Mathieu Magnin 2017-02-27 17:44:08 +01:00
parent b2198663d1
commit 6774dd008f
8 changed files with 67 additions and 36 deletions

View file

@ -55,6 +55,16 @@ class Backoffice::DossiersListController < ApplicationController
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
@procedure = current_gestionnaire.procedures.find(params[:id])
@dossiers_archived = @procedure.dossiers.archived
smart_listing_create :dossiers_archived,
@dossiers_archived,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
end
private

View file

@ -2,7 +2,7 @@ class DossierFacades
#TODO rechercher en fonction de la personne/email
def initialize(dossier_id, email, champ_id = nil)
@dossier = Dossier.where(archived: false).find(dossier_id)
@dossier = Dossier.find(dossier_id)
@champ_id = champ_id
end

View file

@ -232,6 +232,8 @@ class Dossier < ActiveRecord::Base
where(state: TERMINE, archived: false).order("updated_at #{order}")
end
scope :archived, -> { where(archived: true) }
def cerfa_available?
procedure.cerfa_flag? && cerfa.size != 0
end

View file

@ -14,6 +14,7 @@ class DossiersListGestionnaireService
'deposes' => deposes,
'a_instruire' => a_instruire,
'termine' => termine,
'archive' => archive,
'all_state' => all_state}[@liste]
end
@ -50,6 +51,10 @@ class DossiersListGestionnaireService
@a_instruire ||= filter_dossiers.a_instruire
end
def archive
@archive ||= filter_dossiers.archived
end
def termine
@termine ||= filter_dossiers.termine
end

View file

@ -1,9 +1,9 @@
%table#dossiers_list.table
%thead
- if smart_listing.name.to_s == 'follow_dossiers'
%th.col-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
%th.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
%th.col-xs-1
État
- @facade_data_view.preference_list_dossiers_filter.each do |preference|
@ -17,14 +17,14 @@
%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
%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-md-1.col-lg-1.col-sm-1.col-xs-1.col-sm-1.col-xs-1.center
%td.col-xs-1.center
- total_notif = dossier.notifications.where(already_read: false).count
- if total_notif == 0
.badge.progress-bar-default
@ -32,7 +32,7 @@
- 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
%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'

View file

@ -5,51 +5,61 @@
.default_data_block
%div.row.show-block#new_dossiers
%div.header
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
%div.col-xs-10.title
%div.carret-right
%div.carret-down
Nouveaux dossiers
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
=@facade_data_view.nouveaux_total
dossiers
%div.col-xs-2.count
= pluralize(@facade_data_view.nouveaux_total, "dossier")
%div.body
= smart_listing_render :new_dossiers
.row.center
.col-lg-1.col-md-1.col-sm-1.col-xs-1
.col-lg-2.col-md-2.col-sm-2.col-xs-2
.col-xs-2.col-xs-offset-1
=link_to 'Tous les états', '?liste=all_state', class: 'text-info', style:"text-decoration: #{@facade_data_view.liste == 'all_state'? 'underline' : ''}"
.col-lg-2.col-md-2.col-sm-2.col-xs-2
.col-xs-2
=link_to 'En construction', '?liste=a_traiter', class: 'text-danger', style:"text-decoration: #{@facade_data_view.liste == 'a_traiter'? 'underline' : ''}"
.col-lg-2.col-md-2.col-sm-2.col-xs-2
.col-xs-2
=link_to 'À receptionner', '?liste=deposes', class: 'text-purple', style:"text-decoration: #{@facade_data_view.liste == 'deposes'? 'underline' : ''}"
.col-lg-2.col-md-2.col-sm-2.col-xs-2
.col-xs-2
=link_to 'À instruire', '?liste=a_instruire', class: 'text-warning', style:"text-decoration: #{@facade_data_view.liste == 'a_instruire'? 'underline' : ''}"
.col-lg-2.col-md-2.col-sm-2.col-xs-2
.col-xs-2
=link_to 'Terminés', '?liste=termine', class: 'text-success', style:"text-decoration: #{@facade_data_view.liste == 'termine'? 'underline' : ''}"
.default_data_block.default_visible
%div.row.show-block#follow_dossiers
%div.header
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
%div.col-xs-10.title
%div.carret-right
%div.carret-down
Dossiers suivis
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
=@facade_data_view.suivi_total
dossiers
%div.col-xs-2.count
= pluralize(@facade_data_view.suivi_total, "dossier")
%div.body
= smart_listing_render :follow_dossiers
.default_data_block
%div.row.show-block#all_dossiers
%div.header
%div.col-lg-10.col-md-10.col-sm-10.col-xs-10.title
%div.col-xs-10.title
%div.carret-right
%div.carret-down
Tous les dossiers
%div.col-lg-2.col-md-2.col-sm-2.col-xs-2.count
=@facade_data_view.all_state_total
dossiers
%div.col-xs-2.count
= pluralize(@facade_data_view.all_state_total, "dossier")
%div.body
= smart_listing_render :all_state_dossiers
.default_data_block
%div.row.show-block#all_dossiers
%div.header
%div.col-xs-10.title
%div.carret-right
%div.carret-down
Dossiers archivés
%div.col-xs-2.count
= pluralize(@dossiers_archived.count, "dossier")
%div.body
= smart_listing_render :dossiers_archived

View file

@ -1,2 +1,2 @@
%div.col-lg-12.col-md-12.col-sm-12.col-xs-12#backoffice_dossier_show
.col-xs-12#backoffice_dossier_show
= render partial: "dossiers/dossier_show"

View file

@ -1,8 +1,8 @@
%div#first-block
%div.infos
#first-block
.infos
#dossier_id= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s
%div#action-block
#action-block
- if gestionnaire_signed_in?
- if !@facade.dossier.read_only?
= form_tag(url_for({controller: 'backoffice/dossiers', action: :valid, dossier_id: @facade.dossier.id}), class: 'form-inline', method: 'POST') do
@ -23,18 +23,22 @@
%button.action.refuse-dossier
%i.fa.fa-times
- unless @facade.dossier.archived?
- if @facade.dossier.archived?
%hr
%p
Archivé
- else
= link_to 'Archiver', backoffice_dossier_archive_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
%div#menu-block
#menu-block
%div#infos-block
%div.split-hr-left
%div.dossier-state= @facade.dossier.display_state
%div.split-hr-left
%div.notifications
#infos-block
.split-hr-left
.dossier-state= @facade.dossier.display_state
.split-hr-left
.notifications
- if @facade.dossier.notifications.empty?
Aucune notification pour le moment.
- else