-
Notifications
You must be signed in to change notification settings - Fork 24
Add W-9 download to the registration ticket via an "Additional forms" question #1707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,6 +109,22 @@ | |
| <% end %> | ||
| <% end %> | ||
|
|
||
| <!-- Additional forms the registrant asked for during registration --> | ||
| <% if event_registration.w9_requested? %> | ||
| <%= link_to "/documents/awbw-w9.pdf", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 From Claude: Links to a stable, undigested public path on purpose — the W-9 lives at |
||
| target: "_blank", rel: "noopener", | ||
| class: "flex items-center gap-3 rounded-xl border-2 border-blue-200 bg-blue-50 px-4 py-3 hover:bg-blue-100 transition-colors" do %> | ||
| <i class="fa-solid fa-file-pdf text-blue-500 text-xl shrink-0"></i> | ||
|
|
||
| <div class="flex-1 min-w-0 text-left"> | ||
| <p class="font-semibold text-blue-900">Download W-9</p> | ||
| <p class="text-sm text-blue-700">AWBW's W-9 tax form for your records</p> | ||
| </div> | ||
|
|
||
| <i class="fa-solid fa-download text-blue-500 shrink-0"></i> | ||
| <% end %> | ||
| <% end %> | ||
|
|
||
| <!-- Divider --> | ||
| <div class="border-t border-gray-200"></div> | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| class AddW9AndInvoiceRequestedToEventRegistrations < ActiveRecord::Migration[8.1] | ||
| def up | ||
| unless column_exists?(:event_registrations, :w9_requested) | ||
| add_column :event_registrations, :w9_requested, :boolean, default: false, null: false | ||
| end | ||
|
|
||
| unless column_exists?(:event_registrations, :invoice_requested) | ||
| add_column :event_registrations, :invoice_requested, :boolean, default: false, null: false | ||
| end | ||
| end | ||
|
|
||
| def down | ||
| remove_column :event_registrations, :w9_requested, if_exists: true | ||
| remove_column :event_registrations, :invoice_requested, if_exists: true | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,6 +129,46 @@ | |
| end | ||
| end | ||
|
|
||
| # The "Additional forms" question: a multi-select whose checked options drive the | ||
| # resulting registration's invoice_requested / w9_requested flags (see | ||
| # EventRegistrationServices::PublicRegistration). The digital ticket reads those | ||
| # flags to surface the matching downloads. Seeded onto its own section, like the | ||
| # CE question above, so the form builder's add/remove-section logic leaves it | ||
| # alone, and carrying the well-known field_identifier the service keys off. The | ||
| # answer-option names must match the service's ADDITIONAL_FORMS_* constants. | ||
| additional_forms_identifier = EventRegistrationServices::PublicRegistration::ADDITIONAL_FORMS_IDENTIFIER | ||
| if registration_form.form_fields.where(field_identifier: additional_forms_identifier).none? | ||
| next_position = (registration_form.form_fields.maximum(:position) || 0) + 1 | ||
| registration_form.form_fields.create!( | ||
| name: "Additional forms", | ||
| answer_type: :group_header, | ||
| status: :active, | ||
| position: next_position, | ||
| required: false, | ||
| section: "additional_forms", | ||
| visibility: :always_ask | ||
| ) | ||
| additional_forms_field = registration_form.form_fields.create!( | ||
| name: "Do you need either of the following?", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 From Claude: Deliberately |
||
| answer_type: :multi_select_checkbox, | ||
| status: :active, | ||
| position: next_position + 1, | ||
| required: false, | ||
| field_identifier: additional_forms_identifier, | ||
| section: "additional_forms", | ||
| visibility: :always_ask, | ||
| width: :full, | ||
| hint_text: "If selected, these will be available on your digital registration ticket." | ||
| ) | ||
| [ | ||
| EventRegistrationServices::PublicRegistration::ADDITIONAL_FORMS_INVOICE, | ||
| EventRegistrationServices::PublicRegistration::ADDITIONAL_FORMS_W9 | ||
| ].each_with_index do |opt, idx| | ||
| ao = AnswerOption.find_or_create_by!(name: opt) { |a| a.position = idx } | ||
| additional_forms_field.form_field_answer_options.create!(answer_option: ao) | ||
| end | ||
| end | ||
|
|
||
| # Each entry: [title, form_type, cost_cents, scholarship?, visibility, span_days] | ||
| # form_type: :long, :short, or :none. span_days (optional) makes a multi-day event. | ||
| dev_events = [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Static documents | ||
|
|
||
| Files here are served directly at `/documents/<filename>` (no asset digest), so | ||
| links to them stay stable. | ||
|
|
||
| ## awbw-w9.pdf | ||
|
|
||
| The registration ticket links to `/documents/awbw-w9.pdf` when a registrant checks | ||
| "W-9" on the "Additional forms" registration question. It's a single static file | ||
| shared by every registrant (see `EventRegistrationServices::PublicRegistration` and | ||
| `app/views/event_registrations/_ticket.html.erb`). Replace `awbw-w9.pdf` here when | ||
| AWBW issues an updated W-9. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 From Claude: "Additional forms" is a multi-select, so its submitted value is an array of checked labels (e.g.
["Invoice", "W-9"]).Array(...)normalizes the nil/single/array cases before the per-flagcasecmp?checks below.