Skip to content

Commit

Permalink
Merge pull request #4507 from AweysAhmed/4474-switch-steps_for_bank_o…
Browse files Browse the repository at this point in the history
…nboarding

Fixes-4474-by-switching-onboarding-logic-in-ui
  • Loading branch information
cielf committed Jul 10, 2024
2 parents 89b56e4 + 4c1a8fb commit 524eaa9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
32 changes: 16 additions & 16 deletions app/views/dashboard/_getting_started_prompt.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% location_criteria_met = org_stats.storage_locations_added > 0 %>
<% donation_criteria_met = org_stats.donation_sites_added > 0 %>
<% inventory_criteria_met = org_stats.locations_with_inventory.length > 0 %>
<% criterias = [ partner_criteria_met, location_criteria_met, donation_criteria_met, inventory_criteria_met ] %>
<% criterias = [ location_criteria_met, partner_criteria_met, donation_criteria_met, inventory_criteria_met ] %>
<% current_step = criterias.find_index(false) %>
<% if current_step.present? %>
Expand All @@ -30,29 +30,29 @@
current_step: current_step,
criterias: criterias,
lines: ["line-right", "line-right line-left", "line-right line-left", "line-left"],
step_labels: ["Partner Agencies", "Storage Locations", "Donation Sites", "Inventory"]
step_labels: ["Storage Locations", "Partner Agencies", "Donation Sites", "Inventory"]
} %>
</div>

<div class="col-md-12 org-stats-box-container<%= current_step == 0 ? '' : ' d-none visible-xs' %>">
<div class="org-stats-box">
<div class="box-body text-center position-relative">
<div class="org-stats-icon">
<% if partner_criteria_met %>
<% if location_criteria_met %>
<i class="fa fa-check-circle-o fa-2x success" aria-hidden="true"></i>
<% else %>
<i class="fa fa-users fa-2x" aria-hidden="true"></i>
<i class="fa fa-map-marker fa-2x" aria-hidden="true"></i>
<% end %>
<h4><%= pluralize(org_stats.partners_added, 'Partner Agency') %> Added</h4>
<h4><%= pluralize(org_stats.storage_locations_added, 'Storage Location') %> Added</h4>
</div>

<p class="org-stats-desc">
To start building your community in Human Essentials, import a list of your current partner agencies or add them individually.
Add details for all Storage Locations you use for your inventory.
</p>

<div id="org-stats-call-to-action-partners">
<% partner_link_text = partner_criteria_met ? "Add More Partners" : "Add a Partner" %>
<%= new_button_to new_partner_path, { text: partner_link_text, size: "md" } %>
<div id="org-stats-call-to-action-storage-locations">
<% location_link_text = location_criteria_met ? "Add More Storage Locations" : "Add a Storage Location" %>
<%= new_button_to new_storage_location_path, { text: location_link_text, size: "md" } %>
</div>
</div>
</div>
Expand All @@ -62,21 +62,21 @@
<div class="org-stats-box">
<div class="box-body text-center position-relative">
<div class="org-stats-icon">
<% if location_criteria_met %>
<% if partner_criteria_met %>
<i class="fa fa-check-circle-o fa-2x success" aria-hidden="true"></i>
<% else %>
<i class="fa fa-map-marker fa-2x" aria-hidden="true"></i>
<i class="fa fa-users fa-2x" aria-hidden="true"></i>
<% end %>
<h4><%= pluralize(org_stats.storage_locations_added, 'Storage Location') %> Added</h4>
<h4><%= pluralize(org_stats.partners_added, 'Partner Agency') %> Added</h4>
</div>

<p class="org-stats-desc">
Add details for all Storage Locations you use for your inventory.
To start building your community in Human Essentials, import a list of your current partner agencies or add them individually.
</p>

<div id="org-stats-call-to-action-storage-locations">
<% location_link_text = location_criteria_met ? "Add More Storage Locations" : "Add a Storage Location" %>
<%= new_button_to new_storage_location_path, { text: location_link_text, size: "md" } %>
<div id="org-stats-call-to-action-partners">
<% partner_link_text = partner_criteria_met ? "Add More Partners" : "Add a Partner" %>
<%= new_button_to new_partner_path, { text: partner_link_text, size: "md" } %>
</div>
</div>
</div>
Expand Down
18 changes: 9 additions & 9 deletions spec/system/dashboard_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@

# rubocop:disable Layout/ExtraSpacing

# When dashboard loads, ensure that we are on step 1 (Partner Agencies)
# When dashboard loads, ensure that we are on step 1 (Storage Locations)
expect(org_dashboard_page).to have_getting_started_guide
expect(org_dashboard_page).to have_add_partner_call_to_action
expect(org_dashboard_page).not_to have_add_storage_location_call_to_action
expect(org_dashboard_page).to have_add_storage_location_call_to_action
expect(org_dashboard_page).not_to have_add_partner_call_to_action
expect(org_dashboard_page).not_to have_add_donation_site_call_to_action
expect(org_dashboard_page).not_to have_add_inventory_call_to_action

# After we create a partner, ensure that we are on step 2 (Storage Locations)
create(:partner, organization: organization)
# After we create a storage location, ensure that we are on step 2 (Partner Agency)
create(:storage_location, organization: organization)
org_dashboard_page.visit

expect(org_dashboard_page).to have_getting_started_guide
expect(org_dashboard_page).not_to have_add_partner_call_to_action
expect(org_dashboard_page).to have_add_storage_location_call_to_action
expect(org_dashboard_page).to have_add_partner_call_to_action
expect(org_dashboard_page).not_to have_add_storage_location_call_to_action
expect(org_dashboard_page).not_to have_add_donation_site_call_to_action
expect(org_dashboard_page).not_to have_add_inventory_call_to_action

# After we create a storage location, ensure that we are on step 3 (Donation Site)
create(:storage_location, organization: organization)
# After we create a partner agency, ensure that we are on step 3 (Donation Site)
create(:partner, organization: organization)
org_dashboard_page.visit

expect(org_dashboard_page).to have_getting_started_guide
Expand Down

0 comments on commit 524eaa9

Please sign in to comment.