...
 
Commits (14)
......@@ -129,7 +129,7 @@ class ClientsController < ApplicationController
params.require(:client).permit(
:gender_request, :age_request, :other_request, :birth_year, :salutation,
:nationality, :entry_date, :permit, :goals, :education, :interests, :acceptance,
:comments, :additional_comments, :involved_authority_id, :competent_authority,
:comments, :additional_comments, :involved_authority_id, :competent_authority, :other_authorities,
:actual_activities, :cost_unit, language_skills_attributes, relatives_attributes,
contact_attributes, availability_attributes
)
......
......@@ -15,19 +15,25 @@ class LanguageSkill < ApplicationRecord
where.not(id: native_language.id)
}
def self.languages
@languages ||= I18n.t('language_names').merge(I18n.t('language_names_customizations'))
.map { |key, lang| [lang, key.to_s] }.sort
end
class << self
def languages
@languages ||= I18n.t('language_names').merge(I18n.t('language_names_customizations'))
.map { |key, lang| [lang, key.to_s] }.sort
end
def self.native_language
native_languages.first || LanguageSkill.new
end
def native_language
native_languages.first || LanguageSkill.new
end
def self.language_name(language)
return '' if language.blank?
I18n.t("language_names.#{language}")
def language_name(language)
return '' if language.blank?
I18n.t("language_names.#{language}")
end
def native_and_human_readable
german_first.native_languages.map(&:full_language_skills)
end
end
def language_name
......@@ -37,5 +43,5 @@ class LanguageSkill < ApplicationRecord
def full_language_skills
level_human = level? ? I18n.t(level, scope: [:language_level]) : ''
[language_name, level_human].reject(&:blank?).join(', ') if language?
end
end
end
......@@ -44,6 +44,8 @@ nav.navbar.section-navigation
th= t_attr(:involved_authority, Client)
th.truncate-th
span= sort_link @q, :competent_authority, t_attr(:competent_authority, Client)
th.truncate-th
span= sort_link @q, :other_authorities, t_attr(:other_authorities, Client)
th.truncate-th
span= sort_link @q, :created_at, t_attr(:created_at, Client)
- if policy(Client).show_comments?
......@@ -76,6 +78,7 @@ nav.navbar.section-navigation
- if policy(Client).superadmin_privileges?
td= link_to client.involved_authority.full_name, profile_url_path(client.involved_authority) if client.involved_authority
td= client.competent_authority
td= client.other_authorities
td.no-wrap= l(client.created_at.to_date)
- if policy(Client).show_comments?
= td_truncate_content_modal(client.comments, 'Bemerkungen')
......
......@@ -24,13 +24,14 @@ tr id=dom_id(client)
br
td= nationality_name(client.nationality)
td.language-skill-index
- [client.language_skills.german, client.language_skills.native_languages].flatten.each do |language|
span= language.full_language_skills
- client.language_skills.native_and_human_readable.each do |language_readable|
span= language_readable
td= client.goals
td= client.interests
- if policy(Client).superadmin_privileges?
td= link_to client.involved_authority.full_name, profile_url_path(client.involved_authority) if client.involved_authority
td= client.competent_authority
td= client.other_authorities
td.no-wrap= l(client.created_at.to_date)
- if policy(Client).show_comments?
= td_truncate_content_modal(client.comments, 'Bemerkungen')
......@@ -25,8 +25,11 @@ cell_types = [
:string, # 13
:string, # 14
:string, # 15
:time, # 16
:time # 17
:string, # 16
:string, # 17
:string, # 18
:time, # 19
:time # 20
]
cell_styles = [
......@@ -46,8 +49,11 @@ cell_styles = [
standard_format, # 13
standard_format, # 14
standard_format, # 15
date_time_format, # 16
date_time_format # 17
standard_format, # 16
standard_format, # 17
standard_format, # 18
date_time_format, # 19
date_time_format # 20
]
wb.add_worksheet(name: t('clients_xlsx')) do |sheet|
......@@ -68,10 +74,14 @@ wb.add_worksheet(name: t('clients_xlsx')) do |sheet|
t_attr(:education), # 13
t_attr(:entry_date), # 14
t_attr(:acceptance), # 15
t_attr(:created_at), # 16
t_attr(:updated_at) # 17
t_attr(:involved_authority), # 16
t_attr(:language_skills), # 17
t_attr(:goals), # 18
t_attr(:created_at), # 19
t_attr(:updated_at) # 20
]
sheet.add_row header_row, type: :string, style: col_header
clients.each do |client|
salutation = t("salutation.#{client.salutation}") if client.salutation?
......@@ -93,8 +103,11 @@ wb.add_worksheet(name: t('clients_xlsx')) do |sheet|
client.education, # 13
client.entry_date, # 14
t("acceptance.#{client.acceptance}"), # 15
client.created_at.in_time_zone, # 16
client.updated_at.in_time_zone # 17
client.involved_authority, # 16
client.language_skills.native_and_human_readable.join("\r"), # 17
client.goals, # 18
client.created_at.in_time_zone, # 19
client.updated_at.in_time_zone # 20
]
sheet.add_row body_row, types: cell_types, style: cell_styles
end
......
......@@ -66,9 +66,6 @@ fieldset
= f.input :age_request, collection: Client::AGE_REQUESTS, default: :age_no_matter
= f.input :other_request
fieldset
legend Verfügbarkeit?
= render 'availability/form', f: f
.col-xs-12.col-md-6
fieldset
legend Interne Kriterien
......@@ -78,6 +75,16 @@ fieldset
= f.association :involved_authority, collection: @social_workers
= f.input :competent_authority
= f.input :other_authorities
.row
.col-xs-12.col-md-6
fieldset
legend Verfügbarkeit?
= render 'availability/form', f: f
.row
.col-xs-12.col-md-6
fieldset
legend= t_attr(:cost_unit)
= f.input :cost_unit, collection: Client.cost_unit_collection, include_blank: true, label_html: { class: 'sr-only' }
......
......@@ -27,6 +27,8 @@ h1 Klient/innen
th= sort_link @q, :involved_authority_profile_contact_full_name, t_attr(:involved_authority)
th.truncate-th
span= sort_link @q, :competent_authority, t_attr(:competent_authority, Client)
th.truncate-th
span= sort_link @q, :other_authorities, t_attr(:other_authorities, Client)
th.truncate-th
span= sort_link @q, :created_at, t_attr(:created_at, Client)
- if policy(Client).show_comments?
......
......@@ -59,6 +59,10 @@ h1.m-b-20= @client.contact.full_name
td= t_attr(:competent_authority)
td= @client.competent_authority
tr
td= t_attr(:other_authorities)
td= @client.other_authorities
tr
td Kostenträger
td
......
......@@ -50,6 +50,8 @@ table.table.table-striped
th= t_attr(:volunteers)
th= sort_link @q, :group_offer_category_category_name, t_attr(:group_offer_category)
th= sort_link @q, :offer_type, t_attr(:external, GroupOffer)
th= sort_link @q, :created_at
th= sort_link @q, :period_end
tbody
- @group_offers.each do |offer|
......@@ -97,6 +99,8 @@ table.table.table-striped
br
td= link_to offer.group_offer_category.category_name, url_for(q: search_parameters.merge(group_offer_category_id_eq: offer.group_offer_category.id))
td= t_attr(offer.external? ? :external : :internal, GroupOffer)
td= offer.created_at
td= offer.period_end
= bootstrap_paginate(@group_offers)
......
......@@ -24,7 +24,9 @@ wb.add_worksheet(name: t('group_offers', count: 2)) do |sheet|
t_attr(:duration),
t_attr(:offer_state),
'Verantwortliche/r',
t_attr(:volunteers)
t_attr(:volunteers),
t_attr(:created_at),
t_attr(:period_end)
]
sheet.add_row header_row, style: col_header
......@@ -46,6 +48,7 @@ wb.add_worksheet(name: t('group_offers', count: 2)) do |sheet|
type = t("offer_type.#{offer.offer_type}") if offer.offer_type?
state = t("offer_state.#{offer.offer_state}") if offer.offer_state?
creator = offer.creator if offer.creator
period_end = offer.period_end.to_date if offer.period_end
volunteers = offer.volunteers.map do |volunteer|
role_key = offer.responsible?(volunteer) ? 'responsible' : 'member'
"#{volunteer} (#{I18n.t("activerecord.attributes.group_assignment.#{role_key}")}) #{volunteer.contact.primary_email}"
......@@ -64,7 +67,9 @@ wb.add_worksheet(name: t('group_offers', count: 2)) do |sheet|
durations,
state,
creator,
volunteers.join("\r")
volunteers.join("\r"),
offer.created_at.to_date,
period_end
], types: :string, style: col_body
end
end
......@@ -28,7 +28,9 @@ wb.add_worksheet(name: 'Freiwillige') do |sheet|
t_attr(:created_at),
t_attr(:updated_at),
t_attr(:assignment_count),
t_attr(:waive_alternative)
t_attr(:group_assignment_count),
t_attr(:waive_alternative),
t_attr(:intro_course)
]
......@@ -60,7 +62,9 @@ wb.add_worksheet(name: 'Freiwillige') do |sheet|
l(volunteer.created_at.localtime),
l(volunteer.updated_at.localtime),
volunteer.assignments.count,
volunteer.waive
volunteer.group_assignments.count,
volunteer.waive,
volunteer.intro_course
], types: cell_types, style: cell_styles
end
end
......@@ -333,6 +333,7 @@ de:
cost_unit: Kostenträger
city: Stadt
competent_authority: Anmeldende Stelle
other_authorities: Weitere involvierte Stellen
date_of_year: Geburtsjahr
education: Beruf oder Ausbildung im Herkunftsland
entry_date: Einreisedatum
......@@ -504,6 +505,7 @@ de:
additional_nationality: Zusätzliche Nationalität
additional_phone_numbers: Zusätzliche Telefonnummern
assignment_count: Anzahl begleitungen
group_assignment_count: Anzahl Gruppenangebote
availability: Verfügbarkeit
created_at: Anmeldedatum
external: Extern
......
class AddOtherAuthoritiesToClients < ActiveRecord::Migration[5.1]
def change
add_column :clients, :other_authorities, :text
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190314100216) do
ActiveRecord::Schema.define(version: 20190703153811) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -114,7 +114,7 @@ ActiveRecord::Schema.define(version: 20190314100216) do
t.text "agreement_text", default: "Freiwillige beachten folgende Grundsätze während ihres Einsatzes in der AOZ:\n* Verhaltenskodex für Freiwillige\n* Rechte und Pflichten für Freiwillige\n* AOZ Leitlinien Praktische Integrationsarbeit\n\nAllenfalls auch\n* Verpflichtungserklärung zum Schutz der unbegleiteten minderjährigen Asylsuchenden (MNA)\n* Niederschwellige Gratis-Deutschkurse: Informationen für freiwillige Kursleitende\n"
t.string "pdf_file_name"
t.string "pdf_content_type"
t.integer "pdf_file_size"
t.bigint "pdf_file_size"
t.datetime "pdf_updated_at"
t.bigint "submitted_by_id"
t.bigint "reactivated_by_id"
......@@ -217,6 +217,7 @@ ActiveRecord::Schema.define(version: 20190314100216) do
t.text "additional_comments"
t.bigint "reactivated_by_id"
t.datetime "reactivated_at"
t.text "other_authorities"
t.index ["acceptance"], name: "index_clients_on_acceptance"
t.index ["accepted_at"], name: "index_clients_on_accepted_at"
t.index ["birth_year"], name: "index_clients_on_birth_year"
......@@ -383,7 +384,7 @@ ActiveRecord::Schema.define(version: 20190314100216) do
t.text "agreement_text", default: "Freiwillige beachten folgende Grundsätze während ihres Einsatzes in der AOZ:\n* Verhaltenskodex für Freiwillige\n* Rechte und Pflichten für Freiwillige\n* AOZ Leitlinien Praktische Integrationsarbeit\n\nAllenfalls auch\n* Verpflichtungserklärung zum Schutz der unbegleiteten minderjährigen Asylsuchenden (MNA)\n* Niederschwellige Gratis-Deutschkurse: Informationen für freiwillige Kursleitende\n"
t.string "pdf_file_name"
t.string "pdf_content_type"
t.integer "pdf_file_size"
t.bigint "pdf_file_size"
t.datetime "pdf_updated_at"
t.bigint "submitted_by_id"
t.bigint "reactivated_by_id"
......@@ -553,7 +554,7 @@ ActiveRecord::Schema.define(version: 20190314100216) do
t.datetime "updated_at", null: false
t.string "avatar_file_name"
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.bigint "avatar_file_size"
t.datetime "avatar_updated_at"
t.datetime "deleted_at"
t.boolean "flexible", default: false
......@@ -771,7 +772,7 @@ ActiveRecord::Schema.define(version: 20190314100216) do
t.datetime "deleted_at"
t.string "avatar_file_name"
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.bigint "avatar_file_size"
t.datetime "avatar_updated_at"
t.bigint "user_id"
t.string "rejection_type"
......
......@@ -3,7 +3,7 @@ require 'selenium/webdriver'
Capybara.register_driver :chrome_headless do |app|
chrome_options = {
chromeOptions: { args: %w[headless disable-gpu no-sandbox window-size=1600x2000] }
chromeOptions: { args: %w[headless disable-gpu no-sandbox window-size=1600x2000], w3c: false }
}
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(chrome_options)
Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
......
......@@ -17,17 +17,17 @@ class ClientsXlsxExportTest < ActionDispatch::IntegrationTest
assert_xls_cols_equal(wb, 1, 0, 'id', 'Anrede', 'Nachname', 'Vorname', 'Strasse',
'Adresszusatz', 'PLZ', 'Ort', 'Telefonnummer', 'Telefonnummer 2', 'Mailadresse',
'Jahrgang', 'Nationalität', 'Beruf oder Ausbildung im Herkunftsland',
'Einreisedatum', 'Prozess', 'Erstellt am', 'Aktualisiert am')
'Einreisedatum', 'Prozess', 'Fallführende Stelle', 'Sprachkenntnisse', 'Inhalte der Begleitung', 'Erstellt am', 'Aktualisiert am')
assert_equal client.id.to_s, wb.cell(2, 1).to_s
assert_xls_cols_equal(wb, 2, 1, I18n.t("salutation.#{client.salutation}"),
client.contact.last_name, client.contact.first_name, client.contact.street,
client.contact.extended, client.contact.postal_code, client.contact.city,
client.contact.primary_phone, client.contact.secondary_phone, client.contact.primary_email,
client.birth_year&.year, nationality_name(client.nationality), client.education,
client.entry_date, I18n.t(".acceptance.#{client.acceptance}"))
assert_equal 2.days.ago.to_date, wb.cell(2, 17).to_date
assert_equal 2.days.ago.to_date, wb.cell(2, 18).to_date
client.entry_date, I18n.t(".acceptance.#{client.acceptance}"), client.involved_authority, '', client.goals)
assert_equal 2.days.ago.to_date, wb.cell(2, 20).to_date
assert_equal 2.days.ago.to_date, wb.cell(2, 21).to_date
end
test 'clients xls export is not paginated' do
......
......@@ -23,7 +23,9 @@ class GroupOffersXlsxExportTest < ActionDispatch::IntegrationTest
'Dauer',
'FW-Nachfrage',
'Verantwortliche/r',
'Freiwillige'
'Freiwillige',
'Erstellt am',
'Angebotsenddatum'
)
assert_xls_cols_equal(wb, 2, 1, GroupOffer.first.title)
end
......
......@@ -8,4 +8,35 @@ class VolunteersXlsxExportTest < ActionDispatch::IntegrationTest
get volunteers_url(format: :xlsx)
assert_equal Mime[:xlsx], response.content_type
end
test 'xlsx files has the right columns' do
superadmin = create :user
volunteer = create :volunteer
login_as superadmin
wb = get_xls_from_response(volunteers_url(format: :xlsx))
assert_xls_cols_equal(
wb, 1, 0,
'id',
'Anrede',
'Nachname',
'Vorname',
'Strasse',
'Adresszusatz',
'PLZ',
'Ort',
'Telefonnummer',
'Telefonnummer 2',
'Mailadresse',
'Jahrgang',
'Nationalität',
'Beruf',
'Prozess',
'Anmeldedatum',
'Aktualisiert am',
'Anzahl begleitungen',
'Anzahl Gruppenangebote',
'Spesenverzicht',
'Einführungskurs besucht'
)
end
end
......@@ -49,6 +49,7 @@ class ClientsTest < ApplicationSystemTestCase
select('Angemeldet', from: 'Prozess')
fill_in 'Bemerkungen', with: 'asdfasdf'
fill_in 'Anmeldende Stelle', with: 'asdfasdf'
fill_in 'Weitere involvierte Stellen', with: 'asdfasdf'
select @social_worker.full_name, from: 'Fallführende Stelle'
select('Gemeinde', from: 'Kostenträger')
page.check('client_evening')
......