Merge branch 'develop' into staging
This commit is contained in:
commit
3eedf616e8
6 changed files with 57 additions and 1 deletions
6
app/assets/stylesheets/_card.scss
Normal file
6
app/assets/stylesheets/_card.scss
Normal file
|
@ -0,0 +1,6 @@
|
|||
.card {
|
||||
background: white;
|
||||
padding: 15px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
|
||||
border-radius: 2px;
|
||||
}
|
9
app/assets/stylesheets/administrations/stats.scss
Normal file
9
app/assets/stylesheets/administrations/stats.scss
Normal file
|
@ -0,0 +1,9 @@
|
|||
@import "card";
|
||||
|
||||
.stats {
|
||||
.stat-card {
|
||||
@extend .card;
|
||||
margin: 15px auto;
|
||||
max-width: 1200px;
|
||||
}
|
||||
}
|
24
app/controllers/administrations/stats_controller.rb
Normal file
24
app/controllers/administrations/stats_controller.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
module Administrations
|
||||
class StatsController < ApplicationController
|
||||
before_action :authenticate_administration!
|
||||
|
||||
def index
|
||||
procedures = Procedure.where(created_at: Time.current.all_quarter).group("date_trunc('day', created_at)").count
|
||||
dossiers = Dossier.where(created_at: Time.current.all_quarter).group("date_trunc('day', created_at)").count
|
||||
@procedures = clean_hash(procedures)
|
||||
@dossiers = clean_hash(dossiers)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def clean_hash h
|
||||
h.keys.each{ |key| h[key.to_date] = h[key]; h.delete(key) }
|
||||
min_date = h.keys.min
|
||||
max_date = h.keys.max
|
||||
(min_date..max_date).each do |date|
|
||||
h[date] = 0 if h[date].nil?
|
||||
end
|
||||
h
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,6 +10,9 @@
|
|||
|
||||
%br
|
||||
|
||||
.center
|
||||
=link_to 'Stats', administrations_stats_path, style: 'margin-bottom: 50px; display: block', 'data-no-turbolink': true
|
||||
|
||||
= smart_listing_render :admins
|
||||
|
||||
%br
|
||||
|
|
11
app/views/administrations/stats/index.html.haml
Normal file
11
app/views/administrations/stats/index.html.haml
Normal file
|
@ -0,0 +1,11 @@
|
|||
= javascript_include_tag 'https://code.highcharts.com/highcharts.js', 'chartkick'
|
||||
|
||||
.container
|
||||
.stats
|
||||
.stat-card
|
||||
%h1 Procédures crées
|
||||
= line_chart @procedures
|
||||
|
||||
.stat-card
|
||||
%h1 Dossiers créés
|
||||
= line_chart @dossiers
|
|
@ -42,7 +42,10 @@ Rails.application.routes.draw do
|
|||
get 'admin' => 'admin#index'
|
||||
get 'backoffice' => 'backoffice#index'
|
||||
|
||||
resources :administrations
|
||||
resources :administrations, only: [:index, :create]
|
||||
namespace :administrations do
|
||||
resources :stats, only: [:index]
|
||||
end
|
||||
|
||||
namespace :france_connect do
|
||||
get 'particulier' => 'particulier#login'
|
||||
|
|
Loading…
Reference in a new issue