- url = (cpd_statement_activity.persisted? ? effective_cpd.cpd_statement_cpd_statement_activity_path(cpd_statement_activity.cpd_statement, cpd_statement_activity) : effective_cpd.cpd_statement_cpd_statement_activities_path(cpd_statement_activity.cpd_statement)) - locked = cpd_statement_activity.locked? = effective_form_with(model: cpd_statement_activity, url: (locked ? '#' : url), remote: true, class: 'cpd-statement-activity-form', readonly: locked, disabled: locked) do |f| - statement = cpd_statement_activity.cpd_statement - activity = cpd_statement_activity.cpd_activity - rule = statement.cpd_cycle.rule_for(activity) .float-right= link_to icon('x', class: 'small-1'), '#', 'data-cpd-collapse': true %h3= activity - if activity.body.present? = activity.body.to_s - if cpd_statement_activity.is_carry_over? .alert.alert-warning This activity is read-only because it was carried forward from = cpd_statement_activity.original.cpd_statement.cpd_cycle.to_s .row.my-3 .col-8 %strong #{cpd_credits_label.capitalize} Calculation %br = rule.credit_description.to_s .col-2.text-center - if f.object.persisted? %strong= cpd_credits_label.capitalize %br - if f.object.reduced_messages.present? %span{title: f.object.reduced_messages.values.join("\n\n")}= "#{cpd_score(f.object.score)} *" - else = cpd_score(f.object.score) .col-2.text-center.carry-forward - if f.object.persisted? %strong Carry Forward %br = cpd_score(f.object.carry_forward) .row .col - if activity.amount_label.present? = f.float_field :amount, label: activity.amount_label.capitalize, required: true - if activity.amount2_label.present? = f.float_field :amount2, label: activity.amount2_label.capitalize, required: true - if activity.amount_static? = f.hidden_field :amount, value: 1 %p One (1) #{activity} = f.date_field :date, required: activity.requires_date? = f.file_field :files, label: 'Supporting Documents', required: activity.requires_upload_file? .col = f.text_area :description, placeholder: 'Please provide any additional information about this activity' - unless locked = f.hidden_field :cpd_category_id = f.hidden_field :cpd_activity_id .mb-3 = f.submit do = f.save 'Save Activity' %div{style: 'position: absolute; left: 0;'} - if f.object.new_record? = link_to('Back', '#', class: 'btn btn-secondary', 'data-cpd-back-activity': true) - else - url = effective_cpd.cpd_statement_cpd_statement_activity_path(statement, cpd_statement_activity) = link_to('Delete', url, class: 'btn btn-danger', 'data-confirm': "Really delete?", 'data-method': :delete)