Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -2168,6 +2169,7 @@ hr {

.embassy-ready-badge { background: #16A34A; }
.embassy-processing-badge { background: #CA8A04; }
.embassy-received-badge { background: #1E3A8A; }

.btn-green {
background: #16A34A;
Expand Down
14 changes: 13 additions & 1 deletion app/views/plan/_plan_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -88,6 +89,17 @@
class: "btn btn-navy",
data: { turbo_frame: "_top" } %>

<% when "received" %>
<p class="plan-item__embassy-note">
<span class="embassy-received-badge">Received</span>
Passport's in your hands &mdash; you're all set.
Serial <span class="mono"><%= application.serial %></span>
</p>
<%= link_to "View / Download PDF",
embassy_application_path(application),
class: "btn btn-navy",
data: { turbo_frame: "_top" } %>

<% when "pickup" %>
<p class="plan-item__embassy-note">
<strong>Passport pickup.</strong>
Expand All @@ -98,7 +110,7 @@
</div>
</div>

<% unless %w[pickup submitted ready].include?(state) %>
<% unless %w[pickup submitted ready received].include?(state) %>
<%= button_to "×",
plan_item_path(plan_item),
method: :delete,
Expand Down
29 changes: 29 additions & 0 deletions test/integration/plan_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading