diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 4f83ced..df361e9 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -2153,7 +2153,8 @@ hr { } .embassy-ready-badge, -.embassy-processing-badge { +.embassy-processing-badge, +.embassy-received-badge { display: inline-block; color: #fff; font-size: 0.6875rem; @@ -2168,6 +2169,7 @@ hr { .embassy-ready-badge { background: #16A34A; } .embassy-processing-badge { background: #CA8A04; } +.embassy-received-badge { background: #1E3A8A; } .btn-green { background: #16A34A; diff --git a/app/views/plan/_plan_item.html.erb b/app/views/plan/_plan_item.html.erb index 37c4700..2eaca7b 100644 --- a/app/views/plan/_plan_item.html.erb +++ b/app/views/plan/_plan_item.html.erb @@ -15,6 +15,7 @@ if booking.nil? then "stamping" elsif booking.passport_pickup? then "pickup" elsif booking.stamping? then "stamping" + elsif application&.passport_received_at.present? then "received" elsif application&.ready_at.present? then "ready" elsif application&.submitted? then "submitted" else "pending" @@ -88,6 +89,17 @@ class: "btn btn-navy", data: { turbo_frame: "_top" } %> + <% when "received" %> +

+ Received + Passport's in your hands — you're all set. + Serial <%= application.serial %> +

+ <%= link_to "View / Download PDF", + embassy_application_path(application), + class: "btn btn-navy", + data: { turbo_frame: "_top" } %> + <% when "pickup" %>

Passport pickup. @@ -98,7 +110,7 @@ - <% unless %w[pickup submitted ready].include?(state) %> + <% unless %w[pickup submitted ready received].include?(state) %> <%= button_to "×", plan_item_path(plan_item), method: :delete, diff --git a/test/integration/plan_test.rb b/test/integration/plan_test.rb index d503089..9bbb02c 100644 --- a/test/integration/plan_test.rb +++ b/test/integration/plan_test.rb @@ -227,6 +227,35 @@ class PlanTest < ActionDispatch::IntegrationTest "cancel button is hidden once the embassy says ready") end + test "/plan shows Received badge on embassy card once passport_received_at is set" do + alice = users(:attendee_one) + passport_block = ScheduleItem.create!( + day: "thu", time_label: "9:00 AM", sort_time: 900, + title: "Passport Block", kind: :embassy, is_public: true, + offers_new_passport: true, new_passport_capacity: 4 + ) + plan_item = alice.plan_items.create!(schedule_item: passport_block) + booking = EmbassyBooking.create!( + user: alice, schedule_item: passport_block, plan_item: plan_item, + mode: "new_passport", state: "confirmed" + ) + application = EmbassyApplication.create!( + embassy_booking: booking, state: "submitted", submitted_at: Time.current, + drawn_question_ids: [], notary_profile_id: nil, + ready_at: 1.hour.ago, passport_received_at: Time.current + ) + + sign_in_as alice + get plan_path + + assert_match "embassy-received-badge", response.body + assert_match application.serial, response.body + assert_no_match "embassy-ready-badge", response.body, + "received state takes precedence over ready" + assert_no_match(/aria-label="Cancel appointment"/, response.body, + "cancel button stays hidden once received") + end + test "/plan shows activity attendees, contact form for self, and contacts of co-RSVPers" do alice = users(:attendee_one) vic = users(:volunteer_one)