Commit 6adcbac7 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

Merge branch 'features/ending_of_whole_group_offer' into 'develop'

Beendigung eines gesamten Gruppenangebotes

See merge request !460
parents 6369890c 37f8f038
Pipeline #13923 passed with stage
in 33 minutes and 42 seconds
......@@ -6,7 +6,20 @@ function dateTimePicker() {
clearBtn: true,
language: 'de',
autoclose: true,
todayHighlight: true
todayHighlight: true,
daysOfWeekHighlighted: [0,6],
immediateUpdates: true
});
const datepickersSingle = $('.input-date-picker input').datepicker({
format: 'yyyy-mm-dd',
todayBtn: true,
clearBtn: true,
language: 'de',
autoclose: true,
todayHighlight: true,
daysOfWeekHighlighted: [0,6],
immediateUpdates: true
});
$('#performance_report_period_years li a').each((index, element) => {
$(element).bind('click', (event) => {
......
......@@ -185,3 +185,7 @@ li.button-acceptance a {
max-height: 150px;
overflow-y: auto;
}
.disabled-title {
color: $gray-light;
}
......@@ -40,3 +40,8 @@ fieldset {
flex: 0 0 20%;
}
}
.field-wrapper-inline {
display: inline-block;
margin: 5px;
}
......@@ -22,12 +22,9 @@ class GroupAssignmentsController < ApplicationController
def update
@group_assignment.assign_attributes(group_assignment_params)
if @group_assignment.will_save_change_to_period_end? && @group_assignment.ended?
@group_assignment.period_end_set_by = current_user
period_end_set_notice = { notice: 'Einsatzende wurde erfolgreich gesetzt.' }
end
period_end_set_notice, redirect_action = handle_period_end
if @group_assignment.save
redirect_to @group_assignment.group_offer, period_end_set_notice || make_notice
create_redirect_to(period_end_set_notice, action: redirect_action)
else
render :edit
end
......@@ -35,9 +32,9 @@ class GroupAssignmentsController < ApplicationController
def set_end_today
if @group_assignment.update(period_end: Time.zone.today, period_end_set_by: current_user)
redirect_to @group_assignment.group_offer, notice: 'Einsatzende wurde erfolgreich gesetzt.'
create_redirect_to('Einsatzende wurde erfolgreich gesetzt.')
else
redirect_to @group_assignment.group_offer, notice: 'Einsatzende konnte nicht gesetzt werden.'
create_redirect_to('Einsatzende konnte nicht gesetzt werden.')
end
end
......@@ -59,7 +56,7 @@ class GroupAssignmentsController < ApplicationController
def terminate; end
def update_terminated_at
@group_assignment.volunteer.waive = group_assignment_params[:volunteer_attributes][:waive] == '1'
@group_assignment.volunteer.waive = waive_param_true?
@group_assignment.assign_attributes(group_assignment_params.except(:volunteer_attributes)
.merge(termination_submitted_at: Time.zone.now, termination_submitted_by: current_user))
if @group_assignment.save && terminate_reminder_mailing
......@@ -78,6 +75,27 @@ class GroupAssignmentsController < ApplicationController
private
def handle_period_end
return unless @group_assignment.will_save_change_to_period_end?(from: nil)
@group_assignment.period_end_set_by = current_user
[
'Einsatzende wurde erfolgreich gesetzt.',
params[:redirect_to] || :terminated_group_assignments_index
]
end
def create_redirect_to(notice_text = nil, action: nil)
action ||= params[:redirect_to] unless params[:redirect_to] == 'show'
redirect_to(
polymorphic_path(@group_assignment.group_offer, action: action),
notice: notice_text || make_notice[:notice]
)
end
def waive_param_true?
group_assignment_params[:volunteer_attributes][:waive] == '1'
end
def terminate_reminder_mailing
ReminderMailingVolunteer.termination_for(@group_assignment).map do |rmv|
rmv.mark_process_submitted(current_user, terminate_parent_mailing: true)
......@@ -93,7 +111,7 @@ class GroupAssignmentsController < ApplicationController
def group_assignment_params
params.require(:group_assignment).permit(
:period_start, :period_end, :termination_submitted_at, :terminated_at, :responsible,
:term_feedback_activities, :term_feedback_problems, :term_feedback_success,
:term_feedback_activities, :term_feedback_problems, :term_feedback_success, :redirect_to,
:term_feedback_transfair, volunteer_attributes: [:waive]
)
end
......
class GroupOffersController < ApplicationController
include GroupAssignmentsAttributes
before_action :set_group_offer, only: [:show, :edit, :update, :destroy, :change_active_state]
before_action :set_group_offer, except: [:index, :search, :new, :create]
before_action :set_volunteer_collection
before_action :set_department_manager_collection
......@@ -77,6 +77,30 @@ class GroupOffersController < ApplicationController
end
end
def initiate_termination
@group_offer.period_end = Time.zone.today
end
def submit_initiate_termination
if @group_offer.update(period_end: group_offer_params[:period_end],
period_end_set_by: current_user)
redirect_to group_offers_path, notice: 'Gruppenangebots Beendigung erfolgreich eingeleitet.'
else
render :initiate_termination
end
end
def end_all_assignments
@group_offer.group_assignments.running.each do |group_assignment|
group_assignment.update(
period_end: group_offer_params['group_assignments_attributes']['0']['period_end'],
period_end_set_by: current_user
)
end
redirect_to initiate_termination_group_offer_path(@group_offer),
notice: 'Gruppeneinsätze wurden beendet.'
end
private
def set_group_offer
......@@ -113,10 +137,12 @@ class GroupOffersController < ApplicationController
end
def group_offer_params
params.require(:group_offer).permit(:title, :offer_type, :offer_state, :volunteer_state,
:necessary_volunteers, :description, :women, :men, :children, :teenagers, :unaccompanied,
:all, :long_term, :regular, :short_term, :workday, :weekend, :morning, :afternoon, :evening,
:flexible, :schedule_details, :department_id, :creator_id, :organization, :location,
:group_offer_category_id, group_assignments_attributes)
params.require(:group_offer).permit(
:title, :offer_type, :offer_state, :volunteer_state, :necessary_volunteers, :description,
:women, :men, :children, :teenagers, :unaccompanied, :all, :long_term, :regular,
:short_term, :workday, :weekend, :morning, :afternoon, :evening, :flexible, :schedule_details,
:department_id, :creator_id, :organization, :location, :period_end, :group_offer_category_id,
group_assignments_attributes
)
end
end
......@@ -56,12 +56,16 @@ module FilterDropdownHelper
# :text - string for frontend display
def custom_filter_dropdown(name, *filters)
filter_keys = filters.map { |filter| filter[:q] }
filter_keys += filters.map { |filter| filter[:qs] }
li_dropdown do
concat dropdown_toggle_link(name + custom_text_end(filters))
concat dropdown_ul(tag.li { all_link_to(filter_keys) }) {
filters.map do |filter|
concat li_a_element(filter[:text], custom_filter_url(
filter[:q], filter[:value], *filter_keys.reject { |key| key == filter[:q] }
filter[:q],
filter[:qs],
filter[:value],
*filter_keys.reject { |key| key == filter[:q] }.reject { |key| filter[:qs]&.include? key }
),
class: q_active_class(filter[:q], filter[:value]))
end
......@@ -112,9 +116,10 @@ module FilterDropdownHelper
search_parameters[filter] == value
end
def custom_filter_url(filter, value, *excludes)
url_for(params_except('page')
.merge(q: search_parameters.except(*excludes).merge("#{filter}": value.to_s)))
def custom_filter_url(filter, multi_qs, value, *excludes)
q_values = search_parameters.except(*excludes).merge("#{filter}": value.to_s)
q_values = q_values.merge(multi_qs.map { |q| [q, value.to_s] }.to_h) if multi_qs
url_for(params_except('page').merge(q: q_values))
end
def bool_toggle_url(filter, toggle = false)
......
class DatePickerInput < SimpleForm::Inputs::Base
def input(wrapper_options)
@builder.text_field(attribute_name, input_html_options)
end
def input_html_options
super.merge(class: 'input-sm form-control', data: { provide: 'datepicker' })
end
end
......@@ -21,6 +21,7 @@ module GroupAssignmentAndAssignmentCommon
scope :end_in_future, (-> { where("#{model_name.plural}.period_end > ?", Time.zone.today) })
scope :not_ended, (-> { no_end.or(end_in_future) })
scope :have_start, (-> { where.not(period_start: nil) })
scope :no_start, (-> { where(period_start: nil) })
scope :started, (-> { where("#{model_name.plural}.period_start <= ?", Time.zone.today) })
scope :will_start, (-> { where("#{model_name.plural}.period_start > ?", Time.zone.today) })
......@@ -33,6 +34,7 @@ module GroupAssignmentAndAssignmentCommon
scope :started_ca_six_weeks_ago, lambda {
start_at_or_after(8.weeks.ago).start_at_or_before(6.weeks.ago)
}
scope :no_start_and_end, (-> { no_start.no_end })
scope :with_hours, (-> { joins(:hours) })
......@@ -41,7 +43,7 @@ module GroupAssignmentAndAssignmentCommon
}
scope :active, (-> { not_ended.started.or(no_start.end_in_future) })
scope :stay_active, (-> { active.no_end })
scope :inactive, (-> { ended.or(no_start.no_end).or(will_start) })
scope :inactive, (-> { ended.or(no_start_and_end).or(will_start) })
scope :active_between, lambda { |start_date, end_date|
no_end.start_before(end_date)
.or(start_before(end_date).end_after(start_date))
......@@ -102,7 +104,11 @@ module GroupAssignmentAndAssignmentCommon
end
def ended?
period_start.present? && period_end.present? && period_end <= Time.zone.today
ending? && period_end <= Time.zone.today
end
def ending?
period_start.present? && period_end.present?
end
end
end
......@@ -18,6 +18,8 @@ class GroupAssignment < ApplicationRecord
message: 'Diese/r Freiwillige ist schon im Gruppenangebot'
}
scope :running, (-> { no_end.have_start })
def save_group_assignment_logs
create_log_of_self(period_start_before_last_save, period_end_before_last_save)
end
......
......@@ -10,7 +10,14 @@ class GroupOffer < ApplicationRecord
belongs_to :department, optional: true
belongs_to :group_offer_category
belongs_to :creator, -> { with_deleted }, class_name: 'User', optional: true
belongs_to :creator, -> { with_deleted }, class_name: 'User', optional: true,
inverse_of: 'group_offers'
# termination record relations
belongs_to :period_end_set_by, -> { with_deleted }, class_name: 'User', optional: true,
inverse_of: 'group_offer_period_ends_set'
belongs_to :termination_verified_by, -> { with_deleted }, class_name: 'User', optional: true,
inverse_of: 'group_offer_terminations_verified'
has_many :group_assignments, dependent: :destroy
accepts_nested_attributes_for :group_assignments, allow_destroy: true
......@@ -19,14 +26,21 @@ class GroupOffer < ApplicationRecord
has_many :volunteers, through: :group_assignments
has_many :volunteer_logs, through: :group_assignment_logs
has_many :hours, as: :hourable, dependent: :destroy
has_many :feedbacks, as: :feedbackable, dependent: :destroy
has_many :trial_feedbacks, as: :trial_feedbackable, dependent: :destroy
has_many :hours, as: :hourable, dependent: :destroy, inverse_of: :hourable
has_many :feedbacks, as: :feedbackable, dependent: :destroy, inverse_of: :feedbackable
has_many :trial_feedbacks, as: :trial_feedbackable, inverse_of: :trial_feedbackable,
dependent: :destroy
has_many :volunteer_contacts, through: :volunteers, source: :contact
validates :title, presence: true
validates :necessary_volunteers, numericality: { greater_than: 0 }, allow_nil: true
validates :period_end, absence: {
message: lambda { |object, _|
'Dieses Gruppenangebot kann noch nicht beendet werden, da es noch '\
"#{object.group_assignments.running.count} laufende Gruppeneinsätze hat."
}
}, if: :running_assignments?
scope :active, (-> { where(active: true) })
scope :inactive, (-> { where(active: false) })
......@@ -41,6 +55,10 @@ class GroupOffer < ApplicationRecord
group_assignments.active_between(start_date, end_date).any?
end
def terminatable?
group_assignments.have_start.any? || group_assignment_logs.any?
end
def all_group_assignments_ended_within?(date_range)
ended_within = group_assignments.end_within(date_range).ids
not_end_before = group_assignments.end_after(date_range.last).ids
......@@ -106,4 +124,10 @@ class GroupOffer < ApplicationRecord
def update_search_volunteers
update(search_volunteer: volunteer_contacts.pluck(:full_name).join(', '))
end
private
def running_assignments?
group_assignments.running.any?
end
end
......@@ -14,31 +14,40 @@ class User < ApplicationRecord
has_many :certificates
has_many :clients
has_many :volunteers, inverse_of: 'registrar', foreign_key: 'registrar_id'
has_many :involved_authorities, class_name: 'Client'
has_many :involved_authorities, class_name: 'Client', foreign_key: 'involved_authority_id',
inverse_of: 'involved_authority'
has_many :journals
has_many :assignments, inverse_of: 'creator', foreign_key: 'creator_id'
has_many :feedbacks, inverse_of: 'author', foreign_key: 'author_id'
has_many :billing_expenses
has_many :group_offers, inverse_of: 'creator', foreign_key: 'creator_id'
has_many :reminder_mailings, inverse_of: 'creator', foreign_key: 'creator_id'
has_many :reviewed_feedbacks, class_name: 'Feedback', foreign_key: 'reviewer_id'
has_many :reviewed_trial_feedbacks, class_name: 'TrialFeedback', foreign_key: 'reviewer_id'
has_many :reviewed_hours, class_name: 'Hour', foreign_key: 'reviewer_id'
has_many :reviewed_feedbacks, class_name: 'Feedback', foreign_key: 'reviewer_id',
inverse_of: 'reviewer'
has_many :reviewed_trial_feedbacks, class_name: 'TrialFeedback', foreign_key: 'reviewer_id',
inverse_of: 'reviewer'
has_many :reviewed_hours, class_name: 'Hour', foreign_key: 'reviewer_id', inverse_of: 'reviewer'
# Assignment termination relations
has_many :assignment_period_ends_set, class_name: 'Assignment', foreign_key: 'period_end_set_by'
has_many :assignment_period_ends_set, class_name: 'Assignment',
foreign_key: 'period_end_set_by_id', inverse_of: 'period_end_set_by'
has_many :assignment_terminations_submitted, class_name: 'Assignment',
foreign_key: 'termination_submitted_by'
foreign_key: 'termination_submitted_by_id', inverse_of: 'termination_submitted_by'
has_many :assignment_terminations_verified, class_name: 'Assignment',
foreign_key: 'termination_verified_by'
foreign_key: 'termination_verified_by_id', inverse_of: 'termination_verified_by'
# GroupAssignment termination relations
has_many :group_assignment_period_ends_set, class_name: 'GroupAssignment',
foreign_key: 'period_end_set_by'
foreign_key: 'period_end_set_by_id', inverse_of: 'period_end_set_by'
has_many :group_assignment_terminations_submitted, class_name: 'GroupAssignment',
foreign_key: 'termination_submitted_by'
foreign_key: 'termination_submitted_by_id', inverse_of: 'termination_submitted_by'
has_many :group_assignment_terminations_verified, class_name: 'GroupAssignment',
foreign_key: 'termination_verified_by'
foreign_key: 'termination_verified_by', inverse_of: 'termination_verified_by'
has_many :group_offer_period_ends_set, class_name: 'GroupOffer',
foreign_key: 'period_end_set_by_id', inverse_of: 'period_end_set_by'
has_many :group_offer_terminations_verified, class_name: 'GroupOffer',
foreign_key: 'termination_verified_by_id', inverse_of: 'termination_verified_by'
# Mailing process done relation
has_many :process_submitted_by, class_name: 'ReminderMailingVolunteer'
......
......@@ -48,7 +48,7 @@ class Volunteer < ApplicationRecord
has_many :billing_expenses
has_many :group_assignments
has_many :group_assignments, dependent: :delete_all
has_many :group_assignment_logs
has_many :group_offers, through: :group_assignments
......@@ -328,7 +328,8 @@ class Volunteer < ApplicationRecord
end
def record_acceptance_changed
self["#{acceptance_change_to_be_saved[1]}_at".to_sym] = Time.zone.now if will_save_change_to_acceptance?
return unless will_save_change_to_acceptance?
self["#{acceptance_change_to_be_saved[1]}_at".to_sym] = Time.zone.now
end
def user_deleted?
......
......@@ -16,14 +16,19 @@ class GroupOfferPolicy < ApplicationPolicy
end
# controller action policies
alias_method :index?, :superadmin_or_department_manager_is_responsible?
alias_method :search?, :superadmin_or_department_manager_is_responsible?
alias_method :new?, :superadmin_or_department_manager_is_responsible?
alias_method :create?, :superadmin_or_department_manager_is_responsible?
alias_method :show?, :superadmin_or_departments_offer_or_volunteer_included?
alias_method :edit?, :superadmin_or_department_manager_offer?
alias_method :update?, :superadmin_or_department_manager_offer?
alias_method :change_active_state?, :superadmin_or_department_manager_offer?
alias_method :index?, :superadmin_or_department_manager_is_responsible?
alias_method :search?, :superadmin_or_department_manager_is_responsible?
alias_method :new?, :superadmin_or_department_manager_is_responsible?
alias_method :create?, :superadmin_or_department_manager_is_responsible?
alias_method :show?, :superadmin_or_departments_offer_or_volunteer_included?
alias_method :edit?, :superadmin_or_department_manager_offer?
alias_method :update?, :superadmin_or_department_manager_offer?
alias_method :change_active_state?, :superadmin_or_department_manager_offer?
alias_method :initiate_termination?, :superadmin_or_department_manager_offer?
alias_method :submit_initiate_termination?, :superadmin_or_department_manager_offer?
alias_method :end_all_assignments?, :superadmin_or_department_manager_offer?
alias_method :destroy?, :superadmin?
......
= simple_form_for(@group_assignment) do |f|
= simple_form_for(@group_assignment, url: group_assignment_path(@group_assignment, redirect_to: params[:redirect_to])) do |f|
= simple_error_notice f
dl.dl-horizontal.m-t-30
......
- redirect_to_action ||= nil
.table-responsive.assignments-table
table.table.table-no-border-top
thead
tr
th= t_attr(:volunteer, GroupAssignment)
th= t_attr(:role, GroupAssignment)
th= t_attr(:period_start, GroupAssignment)
th= t_attr(:period_end, GroupAssignment)
th.hidden-print colspan=2 Aktionen
tbody
- group_assignments.each do |group_assignment|
tr
td
= link_to_if(policy(group_assignment.volunteer).show?, group_assignment.volunteer.contact.full_name, volunteer_path(group_assignment.volunteer))
- if params[:format] == 'pdf'
td= group_assignment.volunteer.contact.primary_email
td= group_assignment.responsible ? t_attr(:responsible, GroupAssignment) : t_attr(:member, GroupAssignment)
td= l(group_assignment.period_start) if group_assignment.period_start
td= l(group_assignment.period_end) if group_assignment.period_end
td.index-action-cell.hidden-print
= link_to_if(policy(group_assignment).edit?, 'Bearbeiten', edit_group_assignment_path(group_assignment, redirect_to: redirect_to_action)) { '' }
- if group_assignment.period_end.blank?
= link_to_if(policy(group_assignment).set_end_today?, 'Heute beenden',
set_end_today_group_assignment_path(group_assignment, redirect_to: redirect_to_action),
data: { method: 'PUT' }) { '' }
- elsif group_assignment.termination_submitted_by_id.blank?
= link_to_if(policy(group_assignment).terminate?, 'Beendigungsformular an Freiwillige/n mailen',
polymorphic_path([group_assignment, ReminderMailing], action: :new_termination),
class: 'index-action-link')
= link_to_if(policy(group_assignment).terminate?, 'Beendigungsformular ausfüllen',
polymorphic_path(group_assignment, action: :terminate))
td
- if group_assignment.period_end.present? && policy(GroupAssignment).verify_termination?
= link_to_if(group_assignment.termination_verified_by.blank?, 'Beendigung Quittieren',
verify_termination_group_assignment_path(group_assignment), class: 'btn btn-default',
data: { method: 'PATCH' }) { '' }
......@@ -17,7 +17,12 @@ nav.navbar.section-navigation#filters
ul.list-inline
li= button_link t('clear_filters'), group_offers_path, dimension: 'sm'
= custom_filter_dropdown('Standort', *Department.filterable)
= boolean_toggler_filter_dropdown(:active, 'Status', 'Aktiv', 'Beendet')
= boolean_toggler_filter_dropdown(:active, 'Status', 'Aktiv', 'Deaktiviert')
= custom_filter_dropdown('Beendet',
{ q: :period_end_blank, text: 'Laufend', value: 'true'},
{ q: :period_end_not_null, text: 'Beendung initiert', value: 'true'},
{ q: :termination_verified_by_id_blank, qs: [:period_end_not_null], text: 'Unquitiert', value: 'true'},
{ q: :termination_verified_by_id_not_null, text: 'Beendet', value: 'true'})
= list_filter_dropdown(:offer_state, GroupOffer::OFFER_STATES)
= custom_filter_dropdown('Kategorie', *GroupOfferCategory.filterable_group_offer)
= button_link 'Beendete Begleitungen',
......@@ -85,13 +90,15 @@ 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.index-action-cell.hidden-print
span= link_to t_action(:show), group_offer_path(offer)
span= link_to t('download'), group_offer_path(offer, format: :pdf)
span= link_to t_action(:edit), edit_group_offer_path(offer)
- if policy(GroupOffer).destroy?
span= link_to t_action(:delete), group_offer_path(offer), confirm_deleting(offer)
span= link_to "#{ offer.active? ? t('.deactivate') : t('.activate') }",
change_active_state_group_offer_path(offer), method: :put, remote: :true
= link_to t_action(:show), group_offer_path(offer)
= link_to t('download'), group_offer_path(offer, format: :pdf)
= link_to t_action(:edit), edit_group_offer_path(offer)
- if offer.period_end.blank?
= link_to "#{ offer.active? ? t('.deactivate') : t('.activate') }",
change_active_state_group_offer_path(offer), method: :put, remote: :true
= link_to_if(policy(offer).initiate_termination? && offer.terminatable?,
'Beenden', initiate_termination_group_offer_path(offer)) { '' }
nav.navbar.section-navigation
ul.list-inline
......
h1 Gruppenangebot Beenden
- if @group_offer.group_assignments.running.any?
h2 Noch nicht beendete Gruppeneinsätze
= render 'group_assignments_index', group_assignments: @group_offer.group_assignments.running,
redirect_to_action: :initiate_termination
- if @group_offer.group_assignments.running.size > 1
= simple_form_for(@group_offer, url: end_all_assignments_group_offer_path(@group_offer)) do |f|
h3 Alle Gruppeneinsätze beenden
= f.simple_fields_for :group_assignments do |ga|
- next if ga.index > 0
= ga.input :period_end, as: :string, wrapper: :date_picker_inline,
input_html: { value: Time.zone.today.to_s }, label: false
input.btn.btn-default.btn-sm type='submit' name='commit' value='Jetzt alle Einsätze auf Enddatum beenden' data-disable-with='Begleitung aktualisieren'
hr
h2 class=('disabled-title' if @group_offer.group_assignments.running.any?) Enddatum für das Gruppenangebot setzen
- if @group_offer.group_assignments.running.any?
p.text-danger.text-bigger-1 Um das Gruppenangebot zu beenden, müssen erst alle zugehörigen Gruppeneinsätze beendet sein.
= simple_form_for(@group_offer, method: :put, url: submit_initiate_termination_group_offer_path(@group_offer)) do |f|
= f.input :period_end, as: :date_picker, wrapper: :date_picker, disabled: @group_offer.group_assignments.running.any?
p.text-info.m-b-10.m-t-10.text-bigger-1
em Die Voreinstellung für das Enddatum kann auf ein beliebiges Datum angepasst werden
hr
input.btn.btn-default*{ disabled: @group_offer.group_assignments.running.any? } type='submit' name='commit' value='Gruppenangebots Ende setzen' data-disable-with='Gruppenangebot aktualisieren'
......@@ -73,44 +73,7 @@ h2= @group_offer.title
- if @group_offer.group_assignments.any?
h2 Aktuelle Gruppeneinsätze
.table-responsive.assignments-table
table.table.table-no-border-top
thead
tr
th= t_attr(:volunteer, GroupAssignment)
- if params[:format] == 'pdf'
th Freiwillige Mailadresse
th= t_attr(:role, GroupAssignment)
th= t_attr(:period_start, GroupAssignment)
th= t_attr(:period_end, GroupAssignment)
th.hidden-print colspan=2 Aktionen
tbody
- @group_offer.group_assignments.each do |group_assignment|
- if group_assignment.volunteer
tr
td
= link_to_if(policy(Volunteer).show?, group_assignment.volunteer.contact.full_name, volunteer_path(group_assignment.volunteer))
- if params[:format] == 'pdf'
td= group_assignment.volunteer.contact.primary_email
td= group_assignment.responsible ? t_attr(:responsible, GroupAssignment) : t_attr(:member, GroupAssignment)
td= l(group_assignment.period_start) if group_assignment.period_start
td= l(group_assignment.period_end) if group_assignment.period_end
td.index-action-cell.hidden-print
= link_to_if(policy(group_assignment).edit?, 'Bearbeiten', edit_group_assignment_path(group_assignment)) { '' }
- if group_assignment.period_end.blank?
= link_to_if(policy(group_assignment).set_end_today?, 'Heute beenden',
set_end_today_group_assignment_path(group_assignment),
data: { method: 'PUT' }) { '' }
- elsif group_assignment.termination_submitted_by_id.blank?
= link_to_if(policy(group_assignment).terminate?, 'Beendigungsformular an Freiwillige/n mailen',
polymorphic_path([group_assignment, ReminderMailing], action: :new_termination))
= link_to_if(policy(group_assignment).terminate?, 'Beendigungsformular ausfüllen',
polymorphic_path(group_assignment, action: :terminate))
td
- if group_assignment.period_end.present? && policy(GroupAssignment).verify_termination?
= link_to_if(group_assignment.termination_verified_by.blank?, 'Beendigung Quittieren',
verify_termination_group_assignment_path(group_assignment), class: 'btn btn-default',
data: { method: 'PATCH' }) { '' }
= render 'group_assignments_index', group_assignments: @group_offer.group_assignments, redirect_to_action: :show
- if @group_offer.group_assignment_logs.any?
h2 Archivierte Gruppeneinsätze
......
......@@ -112,6 +112,32 @@ SimpleForm.setup do |config|
end
end
config.wrappers :date_picker, tag: 'div', class: 'input-group date form_datetime input-date-picker', error_class: 'has-error' do |b|