User and Gestionnaire sort list
This commit is contained in:
parent
0d2bd17a9e
commit
7a2b935c04
9 changed files with 68 additions and 40 deletions
|
@ -1,9 +1,16 @@
|
|||
class Backoffice::DossiersController < ApplicationController
|
||||
include SmartListing::Helper::ControllerExtensions
|
||||
helper SmartListing::Helper
|
||||
|
||||
before_action :authenticate_gestionnaire!
|
||||
|
||||
def index
|
||||
@liste = params[:liste] || 'a_traiter'
|
||||
@dossiers = dossiers_to_display.paginate(page: params[:page]).decorate
|
||||
|
||||
@dossiers = smart_listing_create :dossiers,
|
||||
dossiers_to_display,
|
||||
partial: "backoffice/dossiers/list",
|
||||
array: true
|
||||
|
||||
total_dossiers_per_state
|
||||
end
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
class Users::DossiersController < UsersController
|
||||
include SmartListing::Helper::ControllerExtensions
|
||||
helper SmartListing::Helper
|
||||
|
||||
before_action :authenticate_user!
|
||||
before_action :check_siret, only: :create
|
||||
|
||||
|
@ -6,7 +9,11 @@ class Users::DossiersController < UsersController
|
|||
order = 'DESC'
|
||||
|
||||
@liste = params[:liste] || 'a_traiter'
|
||||
@dossiers = dossiers_to_display.paginate(page: params[:page]).decorate
|
||||
|
||||
@dossiers = smart_listing_create :dossiers,
|
||||
dossiers_to_display,
|
||||
partial: "users/dossiers/list",
|
||||
array: true
|
||||
|
||||
total_dossiers_per_state
|
||||
end
|
||||
|
@ -116,12 +123,12 @@ class Users::DossiersController < UsersController
|
|||
end
|
||||
|
||||
def waiting_for_user
|
||||
@en_attente_class = (@liste == 'a_traiter' ? 'active' : '')
|
||||
@a_traiter_class = (@liste == 'a_traiter' ? 'active' : '')
|
||||
@waiting_for_user ||= current_user.dossiers.waiting_for_user 'DESC'
|
||||
end
|
||||
|
||||
def waiting_for_gestionnaire
|
||||
@a_traiter_class = (@liste == 'en_attente' ? 'active' : '')
|
||||
@en_attente_class = (@liste == 'en_attente' ? 'active' : '')
|
||||
@waiting_for_gestionnaire ||= current_user.dossiers.waiting_for_gestionnaire 'DESC'
|
||||
end
|
||||
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
%table.table
|
||||
%thead.row
|
||||
%th.col-md-4.col-lg-4 Procédure
|
||||
%th.col-md-4.col-lg-4 Dossier
|
||||
%th.col-md-2.col-lg-2 État
|
||||
%th.col-md-2.col-lg-2 Date de mise à jour
|
||||
- @dossiers.each do |dossier|
|
||||
%tr
|
||||
%td= dossier.procedure.libelle
|
||||
%td
|
||||
= link_to(dossier.nom_projet, "/backoffice/dossiers/#{dossier.id}")
|
||||
%td= dossier.display_state
|
||||
%td= dossier.last_update
|
||||
- unless smart_listing.empty?
|
||||
%table.table
|
||||
%thead.row
|
||||
%th.col-md-4.col-lg-4= smart_listing.sortable 'Procédure', 'procedure.libelle'
|
||||
%th.col-md-4.col-lg-4= smart_listing.sortable 'Dossier', 'nom_projet'
|
||||
%th.col-md-2.col-lg-2= smart_listing.sortable 'État', 'state'
|
||||
%th.col-md-2.col-lg-2= smart_listing.sortable 'Date de mise à jour', 'updated_at'
|
||||
|
||||
.pagination
|
||||
= will_paginate @dossiers, renderer: BootstrapPagination::Rails
|
||||
- @dossiers.each do |dossier|
|
||||
- dossier = dossier.decorate
|
||||
%tr
|
||||
%td= dossier.procedure.libelle
|
||||
%td
|
||||
= link_to(dossier.nom_projet, "/backoffice/dossiers/#{dossier.id}")
|
||||
%td= dossier.display_state
|
||||
%td= dossier.last_update
|
||||
|
||||
= smart_listing.paginate
|
||||
= smart_listing.pagination_per_page_links
|
||||
- else
|
||||
%h4.center
|
||||
Aucun dossier
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#backoffice_index
|
||||
= render partial: 'onglets'
|
||||
|
||||
= render partial: 'list'
|
||||
= smart_listing_render :dossiers
|
||||
|
|
1
app/views/backoffice/dossiers/index.js.erb
Normal file
1
app/views/backoffice/dossiers/index.js.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= smart_listing_update :dossiers %>
|
|
@ -1,17 +1,23 @@
|
|||
%table.table
|
||||
%thead
|
||||
%th Procédure
|
||||
%th Nom du Projet
|
||||
%th Etat
|
||||
%th Mise à jour
|
||||
- @dossiers.each do |dossier|
|
||||
%tr
|
||||
%td
|
||||
= dossier.procedure.libelle
|
||||
%td
|
||||
= link_to(dossier.nom_projet, users_dossier_recapitulatif_path(dossier))
|
||||
%td{id: "dossier_#{dossier.id}_state"}= dossier.display_state
|
||||
%td= dossier.last_update
|
||||
- unless smart_listing.empty?
|
||||
%table.table
|
||||
%thead
|
||||
%th.col-md-4.col-lg-4= smart_listing.sortable 'Procédure', 'procedure.libelle'
|
||||
%th.col-md-4.col-lg-4= smart_listing.sortable 'Nom du Projet', 'nom_projet'
|
||||
%th.col-md-2.col-lg-2= smart_listing.sortable 'État', 'state'
|
||||
%th.col-md-2.col-lg-2= smart_listing.sortable 'Date de mise à jour', 'updated_at'
|
||||
- @dossiers.each do |dossier|
|
||||
- dossier = dossier.decorate
|
||||
%tr
|
||||
%td
|
||||
= dossier.procedure.libelle
|
||||
%td
|
||||
= link_to(dossier.nom_projet, users_dossier_recapitulatif_path(dossier))
|
||||
%td{id: "dossier_#{dossier.id}_state"}= dossier.display_state
|
||||
%td= dossier.last_update
|
||||
|
||||
.pagination
|
||||
= will_paginate @dossiers, renderer: BootstrapPagination::Rails
|
||||
= smart_listing.paginate
|
||||
= smart_listing.pagination_per_page_links
|
||||
|
||||
- else
|
||||
%h4.center
|
||||
Aucun dossier
|
||||
|
|
|
@ -3,21 +3,21 @@
|
|||
|
||||
#onglets
|
||||
%ul.nav.nav-tabs
|
||||
%li{ class: (@dossiers.active_class_a_traiter(@liste) unless @dossiers.nil?) }
|
||||
%li{ class: @a_traiter_class }
|
||||
%a{:href => "#{url_for users_dossiers_path(liste: 'a_traiter')}"}
|
||||
%h5.text-danger
|
||||
= "À traiter "
|
||||
.badge.progress-bar-danger
|
||||
= @dossiers_a_traiter_total
|
||||
|
||||
%li{ class: (@dossiers.active_class_en_attente(@liste) unless @dossiers.nil?) }
|
||||
%li{ class: @en_attente_class }
|
||||
%a{:href => "#{url_for users_dossiers_path(liste: 'en_attente')}"}
|
||||
%h5.text-info
|
||||
="En attente "
|
||||
.badge.progress-bar-info
|
||||
= @dossiers_en_attente_total
|
||||
|
||||
%li{ class: (@dossiers.active_class_termine(@liste) unless @dossiers.nil?) }
|
||||
%li{ class: @termine_class }
|
||||
%a{:href => "#{url_for users_dossiers_path(liste: 'termine')}"}
|
||||
%h5.text-success
|
||||
= "Terminé"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#users_index
|
||||
= render partial: 'onglets'
|
||||
|
||||
= render partial: 'list'
|
||||
= smart_listing_render :dossiers
|
1
app/views/users/dossiers/index.js.erb
Normal file
1
app/views/users/dossiers/index.js.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= smart_listing_update :dossiers %>
|
Loading…
Reference in a new issue