From 8e2de460125341074e7e5a357b918440939e851d Mon Sep 17 00:00:00 2001 From: tees <12987958+teesloane@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:19:52 -0400 Subject: [PATCH] Add: signup_notes, rename rider_notes. (#385) add: add signup_notes, rename rider_notes. This was done so that we could include signup related information when riders signup for a delivery. It has also been on the backlog to rename "rider_notes" to "delivery_instructions" --- lib/bike_brigade/delivery.ex | 2 +- lib/bike_brigade/delivery/task.ex | 7 ++++--- lib/bike_brigade/gsheets_importer.ex | 4 ++-- .../controllers/campaign_controller.ex | 2 +- .../campaign_live/task_form_component.html.heex | 11 ++++++++++- .../campaign_live/tasks_list_component.html.heex | 2 +- .../live/campaign_signup_live/show.html.heex | 14 ++++++++++++-- .../live/delivery_live/show.html.heex | 4 ++-- .../live/sms_message_live/index.ex | 2 +- ...749_add_signup_notes_and_rename_rider_notes.exs | 11 +++++++++++ test/bike_brigade/delivery_test.exs | 2 +- 11 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 priv/repo/migrations/20240607134749_add_signup_notes_and_rename_rider_notes.exs diff --git a/lib/bike_brigade/delivery.ex b/lib/bike_brigade/delivery.ex index 4abbd873..b63ddd5e 100644 --- a/lib/bike_brigade/delivery.ex +++ b/lib/bike_brigade/delivery.ex @@ -638,7 +638,7 @@ defmodule BikeBrigade.Delivery do task_details = for task <- tasks do - "Name: #{task.dropoff_name}\nPhone: #{task.dropoff_phone}\nType: #{BikeBrigadeWeb.CampaignHelpers.request_type(task)}\nAddress: #{task.dropoff_location}\nNotes: #{task.rider_notes}" + "Name: #{task.dropoff_name}\nPhone: #{task.dropoff_phone}\nType: #{BikeBrigadeWeb.CampaignHelpers.request_type(task)}\nAddress: #{task.dropoff_location}\nNotes: #{task.delivery_instructions}" end |> Enum.join("\n\n") diff --git a/lib/bike_brigade/delivery/task.ex b/lib/bike_brigade/delivery/task.ex index 6293260d..22659c9e 100644 --- a/lib/bike_brigade/delivery/task.ex +++ b/lib/bike_brigade/delivery/task.ex @@ -23,7 +23,8 @@ defmodule BikeBrigade.Delivery.Task do :delivery_status, :delivery_status_notes, :partner_tracking_id, - :rider_notes, + :delivery_instructions, + :signup_notes, :assigned_rider_id, :campaign_id ] @@ -33,8 +34,8 @@ defmodule BikeBrigade.Delivery.Task do :dropoff_location ] schema "tasks" do - # TODO: rename to delivery_instructions - field :rider_notes, :string + field :delivery_instructions, :string + field :signup_notes, :string field :dropoff_name, :string field :dropoff_phone, EctoPhoneNumber.Canadian diff --git a/lib/bike_brigade/gsheets_importer.ex b/lib/bike_brigade/gsheets_importer.ex index 65d76be7..a63e5488 100644 --- a/lib/bike_brigade/gsheets_importer.ex +++ b/lib/bike_brigade/gsheets_importer.ex @@ -156,7 +156,7 @@ defmodule BikeBrigade.GSheetsImporter do dropoff_name: name, dropoff_phone: phone, dropoff_location: %{address: street, postal: postal}, - rider_notes: notes, + delivery_instructions: notes, delivery_status: :pending, partner_tracking_id: partner_tracking_id, task_items: [%{count: count, item_id: item_id}] @@ -204,7 +204,7 @@ defmodule BikeBrigade.GSheetsImporter do dropoff_name: name, dropoff_phone: phone, dropoff_location: %{address: street, postal: postal}, - rider_notes: notes, + delivery_instructions: notes, delivery_status: :pending, partner_tracking_id: partner_tracking_id, task_items: task_items diff --git a/lib/bike_brigade_web/controllers/campaign_controller.ex b/lib/bike_brigade_web/controllers/campaign_controller.ex index 3e4533c6..8aa2247c 100644 --- a/lib/bike_brigade_web/controllers/campaign_controller.ex +++ b/lib/bike_brigade_web/controllers/campaign_controller.ex @@ -46,7 +46,7 @@ defmodule BikeBrigadeWeb.CampaignController do task.dropoff_location, task.dropoff_phone, CampaignHelpers.request_type(task), - task.rider_notes + task.delivery_instructions ] end diff --git a/lib/bike_brigade_web/live/campaign_live/task_form_component.html.heex b/lib/bike_brigade_web/live/campaign_live/task_form_component.html.heex index b69f74b8..fff494aa 100644 --- a/lib/bike_brigade_web/live/campaign_live/task_form_component.html.heex +++ b/lib/bike_brigade_web/live/campaign_live/task_form_component.html.heex @@ -68,7 +68,16 @@ - <.input type="textarea" field={{f, :rider_notes}} label="Notes" /> + <.input + type="textarea" + field={{f, :delivery_instructions}} + label="Delivery Instructions (sent to rider when doing delivery)" + /> + <.input + type="textarea" + field={{f, :signup_notes}} + label="Signup Notes (shown on rider signup - No personal information in this notes, please!)" + /> <:actions> <.button type="submit" phx-disable-with="Saving...">Save diff --git a/lib/bike_brigade_web/live/campaign_live/tasks_list_component.html.heex b/lib/bike_brigade_web/live/campaign_live/tasks_list_component.html.heex index cb0275f2..7b3a58b5 100644 --- a/lib/bike_brigade_web/live/campaign_live/tasks_list_component.html.heex +++ b/lib/bike_brigade_web/live/campaign_live/tasks_list_component.html.heex @@ -91,7 +91,7 @@
- <%= task.rider_notes %> + <%= task.delivery_instructions %>
diff --git a/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex b/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex index 2f1a44b1..3ef8a08d 100644 --- a/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex +++ b/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex @@ -23,6 +23,10 @@ <:col :let={task} label="Dropoff Neighbourhood"> <%= Locations.neighborhood(task.dropoff_location) %> + + <:col :let={task} label="Signup Notes"> + <%= task.signup_notes %> + <:action :let={task}> <.signup_button id="signup-btn-desktop" @@ -33,7 +37,9 @@ + +