= effective_form_with model: [:admin, user] do |f| = f.hidden_field :id %p #{cpd_targets_label} set the requirements checked when submitting a #{cpd_statement_label} %table.table.table-striped.table-hover.table-sm %thead %th= cpd_cycle_label %th Default Requirements %th Requirements for #{f.object} %tbody = f.fields_for :cpd_targets, f.object.build_cpd_targets do |ctf| = ctf.hidden_field :id = ctf.hidden_field :cpd_cycle_id = ctf.hidden_field :user_type = ctf.hidden_field :user_id - collection = Effective::CpdTarget::REQUIRED_TO_SUBMIT - cpd_cycle = ctf.object.cpd_cycle - target = f.object.cpd_target_score(cpd_cycle: cpd_cycle) - required_to_submit = f.object.cpd_target_score_required_to_submit?(cpd_cycle: cpd_cycle) - default_target = f.object.default_cpd_target_score(cpd_cycle: cpd_cycle) || 0 - default_required_to_submit = f.object.default_cpd_target_score_required_to_submit?(cpd_cycle: cpd_cycle) %tr %td= link_to(cpd_cycle, effective_cpd.edit_admin_cpd_cycle_path(cpd_cycle), target: '_blank') %td = pluralize(default_target, cpd_credit_label.downcase) = default_required_to_submit ? 'required' : 'targeted' and = collection.find { |value| value.last == default_required_to_submit }.first.downcase %td .row .col = ctf.number_field :score, required: false, label: false .col = ctf.select :required_to_submit, Effective::CpdTarget::REQUIRED_TO_SUBMIT, required: false, label: false = f.save "Save #{cpd_targets_label}", 'data-confirm': "Really Save #{cpd_targets_label} for #{user}?"