Compare commits
10 Commits
684d7190f6
...
91df2dfac3
| Author | SHA1 | Date |
|---|---|---|
|
|
91df2dfac3 | |
|
|
1c81dd02c5 | |
|
|
4a462d450e | |
|
|
a2d49e8b47 | |
|
|
542da6aaf0 | |
|
|
02c3d5c4ce | |
|
|
f5670847f6 | |
|
|
134661dcd8 | |
|
|
09fb6af0a2 | |
|
|
f1fcf68568 |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
|
|
@ -0,0 +1,47 @@
|
|||
class DashboardController < ApplicationController
|
||||
def index
|
||||
@monitor = []
|
||||
general_data
|
||||
visits_data
|
||||
pdfs_data
|
||||
search_data
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def general_data
|
||||
@monitor << [
|
||||
Dotation.all.size,
|
||||
Dotation.public_dot.size,
|
||||
FilterForEmail.all.size,
|
||||
EmailMessage.all.size
|
||||
]
|
||||
end
|
||||
|
||||
def visits_data
|
||||
@monitor << [
|
||||
VisitHistory.visits.si_index.count,
|
||||
VisitHistory.visits.si_index.by_today.size,
|
||||
VisitHistory.visits.si_index.by_7days.size,
|
||||
VisitHistory.visits.si_index.by_30days.size
|
||||
]
|
||||
end
|
||||
|
||||
def pdfs_data
|
||||
@monitor << [
|
||||
VisitHistory.pdf_files.count,
|
||||
VisitHistory.pdf_files.by_today.size,
|
||||
VisitHistory.pdf_files.by_7days.size,
|
||||
VisitHistory.pdf_files.by_30days.size
|
||||
]
|
||||
end
|
||||
|
||||
def search_data
|
||||
@monitor << [
|
||||
VisitHistory.search.count,
|
||||
VisitHistory.search.by_today.size,
|
||||
VisitHistory.search.by_7days.size,
|
||||
VisitHistory.search.by_30days.size
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
@ -96,6 +96,7 @@ class GrantsController < ApplicationController
|
|||
@experts = Expert.all
|
||||
@expenses = Expense.all
|
||||
@partners = Partner.all
|
||||
@locations = Location.where.not(id: 1)
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
|
|
@ -112,6 +113,6 @@ class GrantsController < ApplicationController
|
|||
:start_date_month, :end_date_month, :ann_date_month,
|
||||
:start_date_always, :end_date_always, :ann_date_always,
|
||||
project_ids: [], tag_ids: [], company_activity_ids: [],
|
||||
company_size_ids: [], expense_ids: [])
|
||||
company_size_ids: [], expense_ids: [], location_ids: [])
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ class HomeController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
VisitHistory.create(ip_address: request.remote_ip, event: 0, site: 0)
|
||||
puts request.remote_ip
|
||||
require 'json'
|
||||
prepare_filters
|
||||
cookies[:filter] = JSON.generate(build_filter_hash)
|
||||
|
|
@ -25,6 +27,7 @@ class HomeController < ApplicationController
|
|||
end
|
||||
|
||||
def search
|
||||
VisitHistory.create(ip_address: request.remote_ip, event: 1)
|
||||
require 'json'
|
||||
prepare_filters
|
||||
cookies[:filter] = JSON.generate(build_filter_hash)
|
||||
|
|
@ -36,10 +39,12 @@ class HomeController < ApplicationController
|
|||
end
|
||||
|
||||
def contact
|
||||
VisitHistory.create(ip_address: request.remote_ip, event: 0, site: 1)
|
||||
@email_message = EmailMessage.new
|
||||
end
|
||||
|
||||
def statute
|
||||
VisitHistory.create(ip_address: request.remote_ip, event: 0, site: 2)
|
||||
@setting = Setting.first
|
||||
end
|
||||
|
||||
|
|
@ -64,14 +69,29 @@ class HomeController < ApplicationController
|
|||
SendContactEmailJob.perform_later(@consultation_email.id)
|
||||
end
|
||||
|
||||
def arrange_consultation
|
||||
VisitHistory.create(ip_address: request.remote_ip, event: 0, site: 3)
|
||||
end
|
||||
|
||||
def monitor
|
||||
VisitHistory.create(ip_address: request.remote_ip, event: 0, site: 4)
|
||||
prepare_filters
|
||||
cookies[:filter] = JSON.generate(build_filter_hash)
|
||||
end
|
||||
|
||||
def show
|
||||
@dotation = Dotation.friendly.find(params[:id])
|
||||
@intersting_dotations = Dotation.public_dot.point_desc
|
||||
.where.not(id: @dotation.id).limit(4)
|
||||
@company_sizes = CompanySize.all
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.html do
|
||||
VisitHistory.create(ip_address: request.remote_ip, event: 0, site: 5,
|
||||
dotation_id: @dotation.id)
|
||||
end
|
||||
format.pdf do
|
||||
VisitHistory.create(ip_address: request.remote_ip, event: 2, site: 5,
|
||||
dotation_id: @dotation.id)
|
||||
pdf1a = WickedPdf.new.pdf_from_string(
|
||||
render_cover_header(@dotation, @company_sizes),
|
||||
{pdf: 'cover_header',
|
||||
|
|
@ -109,9 +129,15 @@ class HomeController < ApplicationController
|
|||
|
||||
def emailfilter
|
||||
require 'json'
|
||||
prepare_filters
|
||||
filters = if params[:from_monit].blank?
|
||||
JSON.parse(cookies[:filter])
|
||||
else
|
||||
JSON.parse(JSON.generate(build_filter_hash))
|
||||
end
|
||||
@emailfilter = FilterForEmail.new(
|
||||
email: params[:email_filter_inp],
|
||||
filters: JSON.parse(cookies[:filter])
|
||||
filters: filters
|
||||
)
|
||||
@emailfilter.save
|
||||
SendNotifyEmailJob.perform_later(@emailfilter.id, 1)
|
||||
|
|
@ -123,6 +149,7 @@ class HomeController < ApplicationController
|
|||
@dotations = Dotation.search_with_filters(filters).public_dot
|
||||
.point_desc.end_date_asc
|
||||
dotation = @dotations.first
|
||||
VisitHistory.create(ip_address: request.remote_ip, event: 2, site: 0)
|
||||
respond_to do |format|
|
||||
format.pdf do
|
||||
pdf1a = WickedPdf.new.pdf_from_string(
|
||||
|
|
@ -166,19 +193,20 @@ class HomeController < ApplicationController
|
|||
@company_size_chk = params[:company_size] || []
|
||||
@company_activity_chk = params[:company_activity] || []
|
||||
@project_chk = params[:project] || []
|
||||
@location_chk = params[:location] || []
|
||||
@company_sizes = CompanySize.all
|
||||
@company_activities = CompanyActivity.all
|
||||
@projects = Project.all
|
||||
@locations = Location.where.not(id: 1)
|
||||
end
|
||||
|
||||
def pdf_header
|
||||
|
||||
end
|
||||
def pdf_header; end
|
||||
|
||||
def build_filter_hash
|
||||
{
|
||||
search: params[:search], company_sizes: @company_size_chk,
|
||||
company_activities: @company_activity_chk, projects: @project_chk,
|
||||
locations: @location_chk,
|
||||
localization: params[:localization], ammount_chk: params[:ammount_chk],
|
||||
ammount_price: params[:ammount_price]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Test controller only admin access
|
||||
class TestController < ApplicationController
|
||||
def add_locations
|
||||
return unless Location.all.blank?
|
||||
|
||||
Location.create(parent_id: nil, name: 'Cała polska')
|
||||
Location.create(parent_id: 1, name: 'dolnośląskie')
|
||||
Location.create(parent_id: 1, name: 'kujawsko-pomorskie')
|
||||
Location.create(parent_id: 1, name: 'lubelskie')
|
||||
Location.create(parent_id: 1, name: 'lubuskie')
|
||||
Location.create(parent_id: 1, name: 'łódzkie')
|
||||
Location.create(parent_id: 1, name: 'małopolskie')
|
||||
Location.create(parent_id: 1, name: 'mazowieckie')
|
||||
Location.create(parent_id: 1, name: 'opolskie')
|
||||
Location.create(parent_id: 1, name: 'podkarpackie')
|
||||
Location.create(parent_id: 1, name: 'podlaskie')
|
||||
Location.create(parent_id: 1, name: 'pomorskie')
|
||||
Location.create(parent_id: 1, name: 'śląskie')
|
||||
Location.create(parent_id: 1, name: 'świętokrzyskie')
|
||||
Location.create(parent_id: 1, name: 'warmińsko-mazurskie')
|
||||
Location.create(parent_id: 1, name: 'wielkopolskie')
|
||||
Location.create(parent_id: 1, name: 'zachodniopomorskie')
|
||||
end
|
||||
end
|
||||
|
|
@ -5,6 +5,7 @@ module ApplicationHelper
|
|||
# icon, name, controller,
|
||||
def nav_menu
|
||||
ret = ''
|
||||
ret += menu_item('fas fa-tachometer-alt', 'Statystyki', '/dashboard', 'dashboard') if admin?
|
||||
ret += menu_item('far fa-circle', 'Dotacje', '/grants', 'grants') if role?('dotations')
|
||||
ret += menu_item('far fa-circle', 'Wydatki', '/expenses', 'expenses') if role?('expenses')
|
||||
ret += menu_item('far fa-circle', 'Wielkość firmy', '/company_sizes', 'company_sizes') if role?('company_sizes')
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
module DashboardHelper
|
||||
end
|
||||
|
|
@ -36,6 +36,7 @@ class Dotation < ApplicationRecord
|
|||
has_and_belongs_to_many :company_sizes
|
||||
has_and_belongs_to_many :projects
|
||||
has_and_belongs_to_many :tags
|
||||
has_and_belongs_to_many :locations
|
||||
has_and_belongs_to_many :company_activities
|
||||
# == Validations ==========================================================
|
||||
validates :name, presence: true, length: { maximum: 255 }
|
||||
|
|
@ -61,6 +62,9 @@ class Dotation < ApplicationRecord
|
|||
scope :by_comp_size, (lambda do |val|
|
||||
joins(:company_sizes).merge(CompanySize.by_ids(val)).distinct
|
||||
end)
|
||||
scope :by_locations, (lambda do |val|
|
||||
joins(:locations).merge(Location.by_ids(val)).distinct
|
||||
end)
|
||||
scope :by_comp_active, (lambda do |val|
|
||||
joins(:company_activities).merge(CompanyActivity.by_ids(val)).distinct
|
||||
end)
|
||||
|
|
@ -92,6 +96,9 @@ class Dotation < ApplicationRecord
|
|||
unless filters[:company_sizes].blank?
|
||||
ret = ret.by_comp_size(filters[:company_sizes])
|
||||
end
|
||||
unless filters[:locations].blank?
|
||||
ret = ret.by_locations(filters[:locations])
|
||||
end
|
||||
unless filters[:company_activities].blank?
|
||||
ret = ret.by_comp_active(filters[:company_activities])
|
||||
end
|
||||
|
|
@ -170,7 +177,12 @@ class Dotation < ApplicationRecord
|
|||
ret = full_descr
|
||||
doc = Nokogiri::HTML(ret)
|
||||
doc.css('iframe').each do |iframe|
|
||||
if iframe['src'].include? 'https'
|
||||
url = iframe['src']
|
||||
else
|
||||
url = 'https:' + iframe['src']
|
||||
end
|
||||
|
||||
new_node = doc.create_element 'a'
|
||||
new_node['href'] = url
|
||||
new_node.inner_html = url
|
||||
|
|
@ -178,4 +190,18 @@ class Dotation < ApplicationRecord
|
|||
end
|
||||
doc
|
||||
end
|
||||
|
||||
def location_to_text
|
||||
ret = ''
|
||||
if locations.size == 16
|
||||
ret = 'Cała polska'
|
||||
else
|
||||
l_size = locations.size
|
||||
locations.each_with_index do |loca, index|
|
||||
ret += loca.name
|
||||
ret += ', ' if l_size > index + 1
|
||||
end
|
||||
end
|
||||
ret
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class Expert < ApplicationRecord
|
|||
|
||||
# == Validations ==========================================================
|
||||
validates :name, presence: true
|
||||
|
||||
validates :description, presence: true, length: { maximum: 500 }
|
||||
# == Scopes ===============================================================
|
||||
|
||||
# == Callbacks ============================================================
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Location < ApplicationRecord
|
||||
# == Constants ============================================================
|
||||
|
||||
# == Attributes ===========================================================
|
||||
|
||||
# == Extensions ===========================================================
|
||||
|
||||
# == Relationships ========================================================
|
||||
has_and_belongs_to_many :dotations
|
||||
# == Validations ==========================================================
|
||||
|
||||
# == Scopes ===============================================================
|
||||
scope :by_ids, ->(val) { where(id: val) }
|
||||
# == Callbacks ============================================================
|
||||
|
||||
# == Class Methods ========================================================
|
||||
|
||||
# == Instance Methods =====================================================
|
||||
end
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# event
|
||||
# 0 - vist
|
||||
# 1 - search
|
||||
# 2 - pdf generation
|
||||
|
||||
# site
|
||||
# 0 - index
|
||||
# 1 - contact
|
||||
# 2 - regulamin
|
||||
# 3 - umow_konsultacje
|
||||
# 4 - monitoring
|
||||
# 5 - dotacja
|
||||
|
||||
# History model
|
||||
class VisitHistory < ApplicationRecord
|
||||
# == Constants ============================================================
|
||||
|
||||
# == Attributes ===========================================================
|
||||
|
||||
# == Extensions ===========================================================
|
||||
|
||||
# == Relationships ========================================================
|
||||
|
||||
# == Validations ==========================================================
|
||||
|
||||
# == Scopes ===============================================================
|
||||
scope :visits, -> { where(event: 0) }
|
||||
scope :search, -> { where(event: 1) }
|
||||
scope :pdf_files, -> { where(event: 2) }
|
||||
scope :by_today, -> { where('created_at > ?', Time.now.midnight) }
|
||||
scope :by_7days, -> { where('created_at > ?', Time.now.midnight - 7.days) }
|
||||
scope :by_30days, -> { where('created_at > ?', Time.now.midnight - 30.days) }
|
||||
scope :dist_ip, -> { select(:ip_address).uniq }
|
||||
scope :si_index, -> { where(site: 0) }
|
||||
scope :si_contact, -> { where(site: 1) }
|
||||
scope :si_statut, -> { where(site: 2) }
|
||||
scope :si_visit, -> { where(site: 3) }
|
||||
scope :si_monitor, -> { where(site: 4) }
|
||||
scope :si_grant, -> { where(site: 5) }
|
||||
# == Callbacks ============================================================
|
||||
|
||||
# == Class Methods ========================================================
|
||||
|
||||
# == Instance Methods =====================================================
|
||||
end
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
<!-- Content Header (Page header) -->
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0">Statystyki</h1>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-sm-6"></div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="container-fluid">
|
||||
<h5 class="mb-2">Ogólne dane</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-info">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[0][0] %></h3>
|
||||
<p>Dotacji w bazie</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-database"></i>
|
||||
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-success">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[0][1] %></h3>
|
||||
<p>Aktywnych dotacji</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-server"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-warning">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[0][2] %></h3>
|
||||
<p>Zapisane filtry</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-filter"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-danger">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[0][3] %></h3>
|
||||
<p>Kontakty od klientów</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-envelope"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<h5 class="mb-2">Wizyty na stronie</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-warning">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[1][0] %></h3>
|
||||
<p>Wszystkie wizyty</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-user-plus"></i>
|
||||
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-light">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[1][1] %></h3>
|
||||
<p>Wizyty - dzisiaj</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-user-plus"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-secondary">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[1][2] %></h3>
|
||||
<p>Wizyty - 7 dni</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-user-plus"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-dark">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[1][3] %></h3>
|
||||
<p>Wizyty - 30 dni</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-user-plus"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<h5 class="mb-2">Wygenerowane pliki PDF</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-primary">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[2][0] %></h3>
|
||||
<p>Pobrane pliki</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-download"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-light">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[2][1] %></h3>
|
||||
<p>Pobrane pliki - dzisiaj</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-download"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-secondary">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[2][2] %></h3>
|
||||
<p>Pobrane pliki - 7 dni</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-download"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-dark">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[2][3] %></h3>
|
||||
<p>Pobrane pliki - 30 dni</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-download"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<h5 class="mb-2">Wyszukiwanie</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-success">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[3][0] %></h3>
|
||||
<p>Wszystkie wyszukania</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-search"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-light">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[3][1] %></h3>
|
||||
<p>Wyszukiwanie - dzisiaj</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-search"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-secondary">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[3][2] %></h3>
|
||||
<p>Wyszukiwanie - 7 dni</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-search"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
|
||||
<div class="small-box bg-dark">
|
||||
<div class="inner">
|
||||
<h3><%= @monitor[3][3] %></h3>
|
||||
<p>Wyszukiwanie - 30 dni</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fas fa-search"></i>
|
||||
</div>
|
||||
<a href="#" class="small-box-footer"> </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -115,7 +115,13 @@
|
|||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<%= form.label :localization %>
|
||||
<%= form.text_field :localization, class: 'form-control', placeholder: 'Wprowadź region' %>
|
||||
<%= form.text_field :localization, class: 'form-control', placeholder: 'Opisowa lokalizacja' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<%= form.label :locations %>
|
||||
<%= form.select(:location_ids, @locations.collect {|p| [ p.name, p.id ] }, { include_blank: false }, { class: 'form-control duallistbox', multiple: true } ) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -261,14 +267,15 @@
|
|||
plugins: [
|
||||
'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview',
|
||||
'anchor', 'searchreplace', 'visualblocks', 'code', 'fullscreen',
|
||||
'insertdatetime', 'media', 'table', 'code', 'wordcount'
|
||||
'insertdatetime', 'media', 'table', 'code', 'wordcount', 'paste'
|
||||
],
|
||||
toolbar: 'undo redo | blocks | ' +
|
||||
'bold italic backcolor | customDictionary | alignleft aligncenter ' +
|
||||
'alignright alignjustify | bullist numlist outdent indent | ' +
|
||||
'removeformat link image media | table tableinsertdialog tablecellprops tableprops advtablerownumbering',
|
||||
'removeformat link image media | table tableinsertdialog tablecellprops tableprops advtablerownumbering pastetext',
|
||||
/* enable title field in the Image dialog*/
|
||||
image_title: true,
|
||||
paste_as_text: true,
|
||||
/* enable automatic uploads of images represented by blob or data URIs*/
|
||||
automatic_uploads: true,
|
||||
/*
|
||||
|
|
@ -328,14 +335,14 @@
|
|||
plugins: [
|
||||
'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview',
|
||||
'anchor', 'searchreplace', 'visualblocks', 'code', 'fullscreen',
|
||||
'insertdatetime', 'media', 'table', 'code', 'wordcount'
|
||||
'insertdatetime', 'media', 'table', 'code', 'wordcount', 'paste'
|
||||
],
|
||||
toolbar: 'undo redo | blocks | ' +
|
||||
'bold italic backcolor | alignleft aligncenter ' +
|
||||
'alignright alignjustify | bullist numlist outdent indent | ' +
|
||||
'removeformat link | table tableinsertdialog tablecellprops tableprops advtablerownumbering',
|
||||
'removeformat link | table tableinsertdialog tablecellprops tableprops advtablerownumbering pastetext',
|
||||
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
|
||||
language: 'pl'
|
||||
paste_as_text: true
|
||||
});
|
||||
|
||||
tinymce.init({
|
||||
|
|
@ -345,13 +352,14 @@
|
|||
plugins: [
|
||||
'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview',
|
||||
'anchor', 'searchreplace', 'visualblocks', 'code', 'fullscreen',
|
||||
'insertdatetime', 'media', 'table', 'code', 'wordcount'
|
||||
'insertdatetime', 'media', 'table', 'code', 'wordcount', 'paste'
|
||||
],
|
||||
toolbar: 'undo redo | blocks | ' +
|
||||
'bold italic backcolor | alignleft aligncenter ' +
|
||||
'alignright alignjustify | bullist numlist outdent indent | ' +
|
||||
'removeformat link | table tableinsertdialog tablecellprops tableprops advtablerownumbering',
|
||||
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }'
|
||||
'removeformat link | table tableinsertdialog tablecellprops tableprops advtablerownumbering pastetext',
|
||||
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
|
||||
paste_as_text: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -77,6 +77,27 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card card-secondary">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title w-100">
|
||||
<a class="d-block w-100 collapsed" data-toggle="collapse" href="#collapseFour" aria-expanded="true">
|
||||
Lokalizacja
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseFour" class="collapse show" data-parent="#accordion" style="">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<% @locations.each do |location| %>
|
||||
<div class="form-check">
|
||||
<%= check_box_tag("location[]", location.id, @location_chk.include?(location.id.to_s) , class: 'form-check-input', onchange: "formSubmit()") %>
|
||||
<label class="form-check-label"><%= location.name %></label>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%#
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<div class="col-md-12">
|
||||
<table style="border: none;">
|
||||
<thead>
|
||||
<tr><th colspan="2"><h4><b>SUBIEKTYWNA OPINIA EKSPERTA</b></h4></th></tr>
|
||||
<tr><th colspan="2"><h4><b>SKRÓT NAJWAŻNIEJSZYCH INFORMACJI</b></h4></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
|
@ -105,6 +105,8 @@
|
|||
<div id="consultation_form_id"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% if false %>
|
||||
<!-- wylaczona opcja dotacji -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p> </p>
|
||||
|
|
@ -118,7 +120,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
|
@ -131,6 +133,7 @@
|
|||
<p> </p>
|
||||
</div>
|
||||
</div>
|
||||
<% unless @dotation.positioning_text.blank? %>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h5>Komentarz do "<%= @dotation.name %>"</h5>
|
||||
|
|
@ -138,12 +141,15 @@
|
|||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<% end %>
|
||||
<% if false %>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<%= render '/partners/partner_show', partner: @dotation.partner, div_id: "consultation_form_2_id" %>
|
||||
<div id="consultation_form_2_id"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<% @dotation.tags.each do |tag| %>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<% if !dotation.expert_id.blank? && !dotation.expert_info.blank? %>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h4><b>SUBIEKTYWNA OPINIA EKSPERTA</b></h4>
|
||||
<h4><b>SKRÓT NAJWAŻNIEJSZYCH INFORMACJI</b></h4>
|
||||
<table style="border: none;">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<h1>Umów bezpłatną konsultację</h1>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Kalendarz konsultacji</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<iframe src="https://grantera.pipedrive.com/scheduler/ZqK2eWCK/konsultacje-wideokonferencja-google-meet" title="Umów bezpłatną konsultację" width="100%" height="720"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<h1>Monitoring</h1>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-8">
|
||||
<%= form_tag(home_emailfilter_path, method: :post, remote: true, id: 'email_filter_form') do %>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Powiadomienie o nowych dotacjach</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="email_filter_inp">Podaj swój adres e-mail</label>
|
||||
<input type="email" class="form-control" name="email_filter_inp" id="email_filter_inp" placeholder="Wprowadź e-mail">
|
||||
</div>
|
||||
<%= hidden_field_tag 'filter', @filter_hash %>
|
||||
<%= hidden_field_tag 'from_monit', 1 %>
|
||||
<div class="callout callout-info">
|
||||
<h5>Ważne informacje</h5>
|
||||
<p>Podając adres e-mail wyrażasz zgodę na otrzymywanie wiadomości o wynikach wyszukiwania spełniających wybrane przez Ciebie kryteria</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
<label for="location">Chcę dostawać informacje o dotacjach na terenie województw:</label>
|
||||
<% @locations.each do |location| %>
|
||||
<div class="form-check">
|
||||
<%= check_box_tag("location[]", location.id, @location_chk.include?(location.id.to_s) , class: 'form-check-input', onchange: "formSubmit()") %>
|
||||
<label class="form-check-label"><%= location.name %></label>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Zapisz powiadomienie</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="col-md-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<style>
|
||||
#map_deep_tech {
|
||||
height: 400px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
<title>Kalendarz Dotacji</title>
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
<%= favicon_link_tag %>
|
||||
<!-- Google Font: Source Sans Pro -->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<title>Kalendarz Dotacji</title>
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
<%= favicon_link_tag %>
|
||||
<!-- Google Font: Source Sans Pro -->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<title>Kalendarz Dotacji</title>
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
<%= favicon_link_tag %>
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-PD48TXDT61"></script>
|
||||
<script>
|
||||
|
|
@ -42,6 +43,9 @@
|
|||
<li class="nav-item d-none d-sm-inline-block">
|
||||
<a href="/kontakt" class="nav-link">Kontakt</a>
|
||||
</li>
|
||||
<li class="nav-item d-none d-sm-inline-block">
|
||||
<a href="/umow_konsultacje" class="nav-link">Umów bezpłatną konsultację</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
<h1>Test#add_locations</h1>
|
||||
<p>Find me in app/views/test/add_locations.html.erb</p>
|
||||
|
|
@ -21,6 +21,7 @@ pl:
|
|||
max_percent: Maksymalny poziom dofinansowania
|
||||
company_activities: Dominująca działalność firmy
|
||||
company_sizes: Wielkość firmy
|
||||
locations: Województwa
|
||||
projects: Rodzaj przedsięwzięcia
|
||||
expert: Ekspert
|
||||
expert_id: Ekspert
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
Rails.application.routes.draw do
|
||||
get 'test/add_locations'
|
||||
get 'dashboard/index'
|
||||
get 'zrezygnuj' => 'email_filter#unsubscribe'
|
||||
get 'email_filter/unsubscribe'
|
||||
get 'kontakt' => 'home#contact'
|
||||
get 'regulamin' => 'home#statute'
|
||||
get 'monitoring' => 'home#monitor'
|
||||
get 'umow_konsultacje' => 'home#arrange_consultation'
|
||||
get 'dotacja/:id' => 'home#show'
|
||||
get 'zestawienie_dotacji/plik' => 'home#prepare_pdf'
|
||||
get 'home/search'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
class CreateLocations < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :locations do |t|
|
||||
t.bigint :parent_id
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
class CreateJoinTableDotationLocation < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_join_table :dotations, :locations do |t|
|
||||
# t.index [:dotation_id, :location_id]
|
||||
# t.index [:location_id, :dotation_id]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
class CreateVisitHistories < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :visit_histories do |t|
|
||||
t.string :ip_address
|
||||
t.bigint :dotation_id
|
||||
t.integer :event
|
||||
t.integer :site
|
||||
t.string :add_data
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :visit_histories, :event
|
||||
add_index :visit_histories, :ip_address
|
||||
add_index :visit_histories, :dotation_id
|
||||
add_index :visit_histories, :site
|
||||
end
|
||||
end
|
||||
28
db/schema.rb
28
db/schema.rb
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_07_31_134927) do
|
||||
ActiveRecord::Schema.define(version: 2022_09_30_202617) do
|
||||
|
||||
create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
|
|
@ -152,6 +152,11 @@ ActiveRecord::Schema.define(version: 2022_07_31_134927) do
|
|||
t.index ["dotation_id", "expense_id"], name: "dot_expind"
|
||||
end
|
||||
|
||||
create_table "dotations_locations", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||
t.bigint "dotation_id", null: false
|
||||
t.bigint "location_id", null: false
|
||||
end
|
||||
|
||||
create_table "dotations_projects", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||
t.bigint "dotation_id", null: false
|
||||
t.bigint "project_id", null: false
|
||||
|
|
@ -212,6 +217,13 @@ ActiveRecord::Schema.define(version: 2022_07_31_134927) do
|
|||
t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id"
|
||||
end
|
||||
|
||||
create_table "locations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||
t.bigint "parent_id"
|
||||
t.string "name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "partners", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
|
|
@ -296,5 +308,19 @@ ActiveRecord::Schema.define(version: 2022_07_31_134927) do
|
|||
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
|
||||
end
|
||||
|
||||
create_table "visit_histories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
||||
t.string "ip_address"
|
||||
t.bigint "dotation_id"
|
||||
t.integer "event"
|
||||
t.integer "site"
|
||||
t.string "add_data"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["dotation_id"], name: "index_visit_histories_on_dotation_id"
|
||||
t.index ["event"], name: "index_visit_histories_on_event"
|
||||
t.index ["ip_address"], name: "index_visit_histories_on_ip_address"
|
||||
t.index ["site"], name: "index_visit_histories_on_site"
|
||||
end
|
||||
|
||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||
end
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 15 KiB |
|
|
@ -0,0 +1,9 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DashboardControllerTest < ActionDispatch::IntegrationTest
|
||||
test "should get index" do
|
||||
get dashboard_index_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
parent_id:
|
||||
name: MyString
|
||||
|
||||
two:
|
||||
parent_id:
|
||||
name: MyString
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
ip_address: MyString
|
||||
dotation_id:
|
||||
event: 1
|
||||
add_data: MyString
|
||||
|
||||
two:
|
||||
ip_address: MyString
|
||||
dotation_id:
|
||||
event: 1
|
||||
add_data: MyString
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class LocationTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class VisitHistoryTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Loading…
Reference in New Issue