- Continue development Tableau de bord

- Optimize toggle block
This commit is contained in:
Xavier J 2016-11-24 19:33:34 +01:00
parent 09fb3d4634
commit 58df3c3a75
23 changed files with 345 additions and 201 deletions

View file

@ -0,0 +1,21 @@
$(document).on('page:load', init_default_data_block);
$(document).ready(init_default_data_block);
function init_default_data_block() {
$('.default_data_block .title').click(function () {
toggle_default_data_bloc(this, 400);
});
$('.default_data_block.default_visible').each(function() {
toggle_default_data_bloc($(this).find('.title'), 0);
});
function toggle_default_data_bloc(element, duration){
var block = $(element).parents('.show-block');
block.children(".body").slideToggle(duration);
block.find(".carret-right").toggle();
block.find(".carret-down").toggle();
}
}

View file

@ -1,21 +1,19 @@
$(document).on('page:load', the_terms);
$(document).ready(the_terms);
$(document).on('page:load', init_collapse);
$(document).ready(init_collapse);
function the_terms() {
var the_terms = $("#dossier_autorisation_donnees");
if(the_terms.size() == 0)
if (the_terms.size() == 0)
return;
check_value (the_terms);
check_value(the_terms);
the_terms.click(function () {
check_value (the_terms);
check_value(the_terms);
});
function check_value (the_terms){
function check_value(the_terms) {
if (the_terms.is(":checked")) {
$("#etape_suivante").removeAttr("disabled");
} else {
@ -24,8 +22,8 @@ function the_terms() {
}
}
function error_form_siret(invalid_siret){
setTimeout(function(){
function error_form_siret(invalid_siret) {
setTimeout(function () {
$("input[type='submit']").val('Erreur SIRET');
}, 10);
@ -35,41 +33,12 @@ function error_form_siret(invalid_siret){
}
function reset_form_siret(){
function reset_form_siret() {
$("input[type='submit']").removeClass('btn-danger').addClass('btn-success').val('Valider');
$("#dossier_siret").removeClass('input-error');
}
function toggle_etape_1(){
function toggle_etape_1() {
$('.row.etape.etape_1 .etapes_menu #logos').toggle(100);
$('.row.etape.etape_1 .etapes_informations #description_procedure').toggle(100);
}
function openning_block(block) {
var right = $(block).find(".carret-right");
var down = $(block).find(".carret-down")
right.addClass("hidden");
down.removeClass("hidden");
}
function closing_block(block) {
var right = $(block).find(".carret-right");
var down = $(block).find(".carret-down")
right.removeClass("hidden");
down.addClass("hidden");
}
function init_collapse() {
$('.title').click(function() {
var block = $(this).parents().closest(".show-block");
var section = block.children(".body");
section.slideToggle(500, function () {});
if ($(section).is("visible") === true) {
closing_block(block);
}
if ($(section).is("visible") === false) {
openning_block(block);
}
});
}

View file

@ -1,7 +1,6 @@
$(document).on('page:load', filters_init);
$(document).ready(filters_init);
function filters_init() {
$('html').click(function(event) {
var visible_filter = $('.filter_framed:visible')
@ -11,11 +10,13 @@ function filters_init() {
}
}
});
$(".filter").on('click', function (event) {
filter_framed_show(event);
filter_framed_close_all_excepted(framed_id(event));
event.stopPropagation();
});
$(".erase-filter").on('click', function (event) {
$(this).parent().find(".filter_input").val("");
});

View file

@ -9,9 +9,18 @@
#backoffice_index, #backoffice_search {
margin-left: 2rem;
margin-right: 2rem;
.default_data_block {
.show-block {
width: 100%;
}
.body {
height: auto;
}
}
}
#pref_list{
#pref_list {
.dropdown-menu {
padding: 10px;
width: 500px;

View file

@ -0,0 +1,60 @@
.default_data_block {
font-family: Arial;
margin-top: 40px;
.show-block {
width: 840px;
min-width: 840px;
margin-left: auto;
margin-right: auto;
box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.5);
margin-bottom: 40px;
}
.carret-right {
float: left;
width: 0;
height: 0;
border-top: 7px solid transparent;
border-bottom: 7px solid transparent;
border-left: 14px solid #FFFFFF;
margin: 12px 12px 0 15px;
}
.carret-down {
float: left;
width: 0;
height: 0;
display: none;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 14px solid #FFFFFF;
margin: 12px 12px 0 15px;
}
.header {
background-color: #003C92;
height: 40px;
color: #FFFFFF;
font-size: 18px;
font-weight: bold;
.title, .action, .count {
cursor: pointer;
height: 100%;
line-height: 40px;
padding: 0px;
text-transform: uppercase;
}
.action {
background-color: #E45B51;
text-align: center;
float: right;
}
.count {
font-size: 16px;
text-align: center;
}
}
.body {
background-color: #FFFFFF;
height: 100px;
display: none;
}
}

View file

@ -1,58 +1,5 @@
#backoffice_dossier_show {
font-family: Arial;
margin-top: 40px;
.show-block {
width: 840px;
min-width: 840px;
margin-left: auto;
margin-right: auto;
box-shadow: 0 0 1px 0 rgba(0,0,0,0.5);
margin-bottom: 40px;
}
.carret-right {
float: left;
width: 0;
height: 0;
border-top: 7px solid transparent;
border-bottom: 7px solid transparent;
border-left: 14px solid #FFFFFF;
margin: 12px 12px 0 15px;
}
.carret-down {
float: left;
width: 0;
height: 0;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 14px solid #FFFFFF;
margin: 12px 12px 0 15px;
}
.header {
background-color: #003C92;
height: 40px;
color: #FFFFFF;
font-size: 18px;
font-weight: bold;
.title, .action, .count {
height: 100%;
line-height: 40px;
padding: 0px;
}
.action {
background-color: #E45B51;
text-align: center;
float: right;
}
.count {
font-size: 16px;
text-align: center;
}
}
.body {
background-color: #FFFFFF;
height: 100px;
display: none;
}
#message {
}
#infos {

View file

@ -32,4 +32,19 @@ h5 span {
#dossiers_list tr:hover{
background-color: #eeeeee;
cursor: pointer;
}
#procedure_list {
.procedure_list_element{
margin-top: 15px;
margin-bottom: 15px;
overflow: hidden;
max-height: 3.6em;
line-height: 1.8em;
}
.procedure_list_element:hover{
background-color: #aaaaaa;
}
}

View file

@ -7,10 +7,11 @@
left: 0;
bottom: 0;
color: white;
overflow: scroll;
#first-block {
font-family: Arial;
font-size: 16px;
font-weight: bold;
line-height: 18px;
}
#action-block {

View file

@ -0,0 +1,4 @@
#search_area{
margin-top: 20px;
margin-bottom: 20px;
}

View file

@ -30,17 +30,32 @@ class Backoffice::DossiersListController < ApplicationController
def smartlisting_dossier dossiers_list=nil, liste='a_traiter'
dossiers_list_facade liste
dossiers_list = dossiers_list_facade.dossiers_to_display if dossiers_list.nil?
new_dossiers_list = dossiers_list_facade.service.nouveaux
follow_dossiers_list = dossiers_list_facade.service.suivi
all_state_dossiers_list = dossiers_list_facade.service.all_state
if param_page.nil?
params[:dossiers_smart_listing] = {page: dossiers_list_facade.service.default_page}
end
@dossiers = smart_listing_create :dossiers,
dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
smart_listing_create :new_dossiers,
new_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
smart_listing_create :follow_dossiers,
follow_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
smart_listing_create :all_state_dossiers,
all_state_dossiers_list,
partial: "backoffice/dossiers/list",
array: true,
default_sort: dossiers_list_facade.service.default_sort
end
private

View file

@ -1,6 +1,8 @@
class DossiersListFacades
include Rails.application.routes.url_helpers
attr_accessor :procedure, :current_devise_profil
def initialize current_devise_profil, liste, procedure = nil
@current_devise_profil = current_devise_profil
@liste = liste
@ -42,6 +44,10 @@ class DossiersListFacades
preference_list_dossiers_filter.where(table: :champs).where.not(filter: '').size == 0
end
def all_state_class
(@liste == 'all_state' ? 'active' : '')
end
def brouillon_class
(@liste == 'brouillon' ? 'active' : '')
end
@ -98,6 +104,10 @@ class DossiersListFacades
(@liste == 'search' ? 'active' : '')
end
def all_state_total
service.all_state.count
end
def brouillon_total
service.brouillon.count
end
@ -154,6 +164,14 @@ class DossiersListFacades
base_url 'brouillon'
end
def all_state_url
base_url 'all_state'
end
def suivi_url
base_url 'suivi'
end
def nouveaux_url
base_url 'nouveaux'
end

View file

@ -8,7 +8,7 @@ class Gestionnaire < ActiveRecord::Base
has_many :assign_to, dependent: :destroy
has_many :procedures, through: :assign_to
has_many :dossiers, through: :procedures
has_many :dossiers, -> { where.not(state: :draft) }, through: :procedures
has_many :follows
has_many :preference_list_dossiers
@ -17,7 +17,7 @@ class Gestionnaire < ActiveRecord::Base
after_update :sync_credentials, if: -> { Features.unified_login }
def dossiers_follow
dossiers.joins(:follows).where("follows.gestionnaire_id = #{id}")
@dossiers_follow ||= dossiers.joins(:follows).where("follows.gestionnaire_id = #{id}")
end
def toggle_follow_dossier dossier_id

View file

@ -7,6 +7,7 @@ class DossiersListGestionnaireService
def dossiers_to_display
{'nouveaux' => nouveaux,
'suivi' => suivi,
'a_traiter' => ouvert,
'fige' => fige,
'deposes' => deposes,
@ -16,13 +17,17 @@ class DossiersListGestionnaireService
end
def self.dossiers_liste_libelle
['nouveaux', 'a_traiter', 'fige' ,'deposes', 'a_instruire', 'termine', 'all_state']
['nouveaux', 'suivi', 'a_traiter', 'fige' ,'deposes', 'a_instruire', 'termine', 'all_state']
end
def all_state
@all_state ||= filter_dossiers.all_state
end
def suivi
@suivi ||= @current_devise_profil.dossiers_follow
end
def nouveaux
@nouveaux ||= filter_dossiers.nouveaux
end

View file

@ -14,7 +14,7 @@
%th.col-md-1.col-lg-1.center Abonnés
- unless smart_listing.empty?
- @dossiers.each do |dossier|
- smart_listing.collection.each do |dossier|
%tr{id: "tr_dossier_#{dossier.id}", 'data-dossier_url' => backoffice_dossier_url(id: dossier.id)}
- @dossiers_list_facade.preference_list_dossiers_filter.each_with_index do |preference, index|
%td
@ -41,7 +41,6 @@
= dossier.total_follow
= smart_listing.paginate
= smart_listing.pagination_per_page_links
- if smart_listing.empty?
%h4.center

View file

@ -1,13 +1,3 @@
#filter_by_procedure{style:'margin-left: 2%'}
%b.text-info
= t('dynamics.backoffice.filter_procedure.title')
%select{onchange: 'location = this.value', style:'margin-top: 10px; margin-bottom: 10px', id: 'filter_by_procedure_select'}
%option{value: backoffice_dossiers_path}
= t('dynamics.backoffice.filter_procedure.first')
- @dossiers_list_facade.gestionnaire_procedures_name_and_id_list.each do |procedure|
%option{value: backoffice_dossiers_procedure_path(procedure[:id]), ('selected' if procedure[:id] == params[:id].to_i) => '' }
= truncate(procedure[:libelle], {length: 50})
#onglets
%ul.nav.nav-tabs
-unless Features.opensimplif
@ -18,49 +8,16 @@
.badge.progress-bar-info
=@dossiers_list_facade.nouveaux_total
%li{ class: (@dossiers_list_facade.a_traiter_class) }
%a{:href => "#{url_for @dossiers_list_facade.a_traiter_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ne sont pas encore déclarés complets.'}
%li{ class: (@dossiers_list_facade.suivi_class) }
%a{:href => "#{url_for @dossiers_list_facade.suivi_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ne sont pas encore déclarés complets.'}
%h5.text-danger
="Ouverts"
="Suivis"
.badge.progress-bar-danger
=@dossiers_list_facade.a_traiter_total
=@dossiers_list_facade.suivi_total
%li{ class: (@dossiers_list_facade.fige_class) }
%a{:href => "#{url_for @dossiers_list_facade.fige_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui sont déclarés complets et donc figés.'}
%li{ class: (@dossiers_list_facade.all_state_class) }
%a{:href => "#{url_for @dossiers_list_facade.all_state_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui sont déclarés complets et donc figés.'}
%h5.text-default
="Figés"
="Tous"
.badge.progress-bar-default
=@dossiers_list_facade.fige_total
%li{ class: (@dossiers_list_facade.deposes_class) }
%a{:href => "#{url_for @dossiers_list_facade.deposes_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ont été validés et déposés par les usager qui attendent une réponse de bonne réception avant examen.'}
%h5.text-purple
="À réceptionner"
.badge.progress-bar-purple
=@dossiers_list_facade.deposes_total
%li{ class: (@dossiers_list_facade.a_instruire_class) }
%a{:href => "#{url_for @dossiers_list_facade.a_instruire_url}", 'data-toggle' => :tooltip, title: 'Les dossiers qui ont été notifiés comme bien réceptionnés et qui attendent un verdict final.'}
%h5.text-warning
= "À instruire"
.badge.progress-bar-warning
=@dossiers_list_facade.a_instruire_total
%li{ class: (@dossiers_list_facade.termine_class) }
%a{:href => "#{url_for @dossiers_list_facade.termine_url}",'data-toggle' => :tooltip, title: 'Tous les dossiers qui ont été traité avec un statut "Validé", "Refusé" ou "Sans suite "'}
%h5.text-success
= "Terminé"
.badge.progress-bar-success
=@dossiers_list_facade.termine_total
%ul.nav.nav-tabs.navbar-right{style:'border-bottom: none;'}
%li#search{ class: (@dossiers_list_facade.search_class) }
%a
= form_tag(backoffice_dossiers_search_url, method: :get) do
.input-group{style:'width: 300px'}
= text_field_tag('q', "#{@search_terms unless @search_terms.nil? }", id: 'q', placeholder: t('dynamics.backoffice.research.placeholder'), class:'form-control')
%span.input-group-btn
%button.btn.btn-default{ id:'search_button' }
%i.fa.fa-search
%br
=@dossiers_list_facade.all_state_total

View file

@ -2,14 +2,41 @@
#pref_list_menu
= render partial: 'backoffice/dossiers/pref_list'
%h1
=t('dynamics.backoffice.title')
.default_data_block
%div.row.show-block#new_dossiers
%div.header
%div.col-lg-10.col-md-10.title
%div.carret-right
%div.carret-down
Nouveaux dossiers
%div.col-lg-2.col-md-2.count
=@facade_data_view.nouveaux_total
dossiers
%div.body
= smart_listing_render :new_dossiers
= render partial: 'backoffice/dossiers/onglets'
.default_data_block.default_visible
%div.row.show-block#follow_dossiers
%div.header
%div.col-lg-10.col-md-10.title
%div.carret-right
%div.carret-down
Dossiers suivis
%div.col-lg-2.col-md-2.count
=@dossiers_list_facade.suivi_total
dossiers
%div.body
= smart_listing_render :follow_dossiers
= smart_listing_render :dossiers
%br
%br
- unless Features.opensimplif
= render partial: 'backoffice/dossiers/state_description', locals: {dossiers_list_facade: @dossiers_list_facade}
.default_data_block
%div.row.show-block#all_dossiers
%div.header
%div.col-lg-10.col-md-10.title
%div.carret-right
%div.carret-down
Tous les dossiers
%div.col-lg-2.col-md-2.count
=@dossiers_list_facade.all_state_total
dossiers
%div.body
= smart_listing_render :all_state_dossiers

View file

@ -1,32 +1,35 @@
%div.col-lg-12.col-md-12#backoffice_dossier_show
%div.row.show-block#messages
%div.header
%div.col-lg-10.col-md-10.title
%div.carret-right
%div.carret-down.hidden
MESSAGES
%div.col-lg-2.col-md-2.count
2 messages
%div.body
.default_data_block
.row.show-block#messages
%div.header
%div.col-lg-10.col-md-10.title
%div.carret-right
%div.carret-down
MESSAGES
%div.col-lg-2.col-md-2.count
2 messages
%div.body
%div.row.show-block#infos
%div.header
%div.col-lg-12.col-md-12.title
%div.carret-right
%div.carret-down.hidden
INFORMATIONS ENTREPRISE / ASSOCIATION / INDIVIDU
%div.body
.default_data_block
%div.row.show-block#infos
%div.header
%div.col-lg-12.col-md-12.title
%div.carret-right
%div.carret-down
INFORMATIONS ENTREPRISE / ASSOCIATION / INDIVIDU
%div.body
%div.row.show-block#dossier
%div.header
%div.col-lg-10.col-md-10.title
%div.carret-right
%div.carret-down.hidden
CONSTRUCTION DU DOSSIER
%div.col-lg-2.col-md-2.action
EDITER
%div.body
.default_data_block
%div.row.show-block#dossier
%div.header
%div.col-lg-10.col-md-10.title
%div.carret-right
%div.carret-down
CONSTRUCTION DU DOSSIER
%div.col-lg-2.col-md-2.action
EDITER
%div.body
%h1#dossier_id.text-info{ :style => 'text-align:right'}
= t('dynamics.dossiers.numéro') + @facade.dossier.id.to_s

View file

@ -11,6 +11,7 @@
= image_tag('marianne_small.png', class: 'logo')
%div.col-lg-6#tps-title
TPS
%div.col-lg-10.col-md-10.no-padding
%div#navbar-body
%div.row

View file

@ -1,2 +1 @@
= render partial: 'layouts/left_panels/left_panel_backoffice_dossierscontroller_index'

View file

@ -1,9 +1,27 @@
%div#first-block
%div.row
%div.col-lg-12.col-md-12
112 dossiers en cours
%div.col-lg-12.col-md-12
> 2 nouveaux dossiers
%div
=@facade_data_view.current_devise_profil.dossiers.where(archived: false).count
DOSSIERS EN COURS
%div
=@facade_data_view.current_devise_profil.dossiers.where(state: :initiated, archived: false).count
NOUVEAUX DOSSIERS
%div#action-block
#search_area
= form_tag(backoffice_dossiers_search_url, method: :get) do
.input-group
= text_field_tag('q', "#{@search_terms unless @search_terms.nil? }", id: 'q', placeholder: t('dynamics.backoffice.research.placeholder'), class:'form-control')
%span.input-group-btn
%button.btn.btn-default{ id:'search_button' }
%i.fa.fa-search
%div#menu-block
%div#infos-block
#procedure_list
%div.procedure_list_element
=link_to "Tous les dossiers", backoffice_dossiers_path
- @dossiers_list_facade.gestionnaire_procedures_name_and_id_list.each do |procedure|
%div.procedure_list_element
=link_to truncate(procedure[:libelle], {length: 50}), backoffice_dossiers_procedure_path(procedure[:id]),{title: procedure[:libelle]}

View file

@ -1,2 +1,2 @@
= render partial: 'layouts/left_panels/left_panel_backoffice_dossierscontroller_index'

View file

@ -1,5 +1,5 @@
%div.col-lg-7.col-md-7.main-info
Start UP region ile de france (8 dossiers en cours)
=@facade_data_view.procedure_id.nil? ? "Tous les dossiers" : truncate(@facade_data_view.procedure.libelle, {length: 50})
%div.col-lg-3.col-md-3.options
%div.row
%div.col-lg-12.col-md-12

View file

@ -0,0 +1,75 @@
SmartListing.configure do |config|
config.global_options({
#:param_names => { # param names
#:page => :page,
#:per_page => :per_page,
#:sort => :sort,
#},
#:array => false, # controls whether smart list should be using arrays or AR collections
#:max_count => nil, # limit number of rows
#:unlimited_per_page => false, # allow infinite page size
#:paginate => true, # allow pagination
#:memorize_per_page => false, # save per page settings in the cookie
:page_sizes => [7], # set available page sizes array
#:kaminari_options => {:theme => "smart_listing"}, # Kaminari's paginate helper options
})
config.constants :classes, {
#:main => "smart-listing",
#:editable => "editable",
#:content => "content",
#:loading => "loading",
#:status => "smart-listing-status",
#:item_actions => "actions",
#:new_item_placeholder => "new-item-placeholder",
#:new_item_action => "new-item-action",
#:new_item_button => "btn",
#:hidden => "hidden",
#:autoselect => "autoselect",
#:callback => "callback",
#:pagination_per_page => "pagination-per-page text-center",
#:pagination_count => "count",
#:inline_editing => "info",
#:no_records => "no-records",
#:limit => "smart-listing-limit",
#:limit_alert => "smart-listing-limit-alert",
#:controls => "smart-listing-controls",
#:controls_reset => "reset",
#:filtering => "filter",
#:filtering_search => "glyphicon-search",
#:filtering_cancel => "glyphicon-remove",
#:filtering_disabled => "disabled",
#:sortable => "sortable",
#:icon_new => "glyphicon glyphicon-plus",
#:icon_edit => "glyphicon glyphicon-pencil",
#:icon_trash => "glyphicon glyphicon-trash",
#:icon_inactive => "glyphicon glyphicon-circle",
#:icon_show => "glyphicon glyphicon-share-alt",
#:icon_sort_none => "glyphicon glyphicon-resize-vertical",
#:icon_sort_up => "glyphicon glyphicon-chevron-up",
#:icon_sort_down => "glyphicon glyphicon-chevron-down",
}
config.constants :data_attributes, {
#:main => "smart-listing",
#:confirmation => "confirmation",
#:id => "id",
#:href => "href",
#:callback_href => "callback-href",
#:max_count => "max-count",
#:inline_edit_backup => "smart-listing-edit-backup",
#:params => "params",
#:observed => "observed",
#:href => "href",
#:autoshow => "autoshow",
#:popover => "slpopover",
}
config.constants :selectors, {
#:item_action_destroy => "a.destroy",
#:edit_cancel => "button.cancel",
#:row => "tr",
#:head => "thead",
#:filtering_icon => "i"
}
end