<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="213168" data-post-id="213168">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="learning123" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  learning123
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Gotcha, I was hesitant to post the full components bcs they’re pretty huge but here they are, thanks so much for the help!!</p>
<p>This is <code>kanban_card_component.ex</code></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule TSSWeb.DispatchHomeLive.Kanban.Card.Component do
  @moduledoc """
  Card component for display truck loads on the dispatch kanban
  """
  use Surface.Component

  alias TSSWeb.Live.Components.{
    Grid,
    CardHeader,
    CardInfo,
    CardStat,
    CardFooterLink,
    CardStatTripTime
  }

  alias TSS.{
    Helpers.Formatters,
    Conversions.Timezone,
    Conversions.Weight,
    TruckLoads.Calls
  }

  alias TSSWeb.Router.Helpers, as: Routes
  alias TSSWeb.SharedHelpers, as: Shared

  prop truck_load, :any
  prop well, :any
  prop current_leg_eta, :map
  prop total_eta, :map
  prop trip_time, :any
  prop show_reroute_button?, :boolean
  prop show_change_pp_button?, :boolean
  prop show_start_over_button?, :boolean
  prop show_drop_trailer_button?, :boolean
  prop show_call_to_well_button?, :boolean
  prop show_unload_button?, :boolean
  prop show_trip_times?, :boolean
  prop show_driver_avail_info?, :boolean

  def mount(socket) do
    {:ok, Surface.init(socket)}
  end

  def update(%{truck_load: %{id: truck_load_id}} = assigns, socket) do
    trip_time = TSS.TripTimes.TruckLoads.get_trip_time_message(truck_load_id)
    assigns = Map.put(assigns, :trip_time, trip_time)
    {:ok, assign(socket, assigns)}
  end

  def render(assigns) do
    ~H"""
    &lt;div class={{ dispatch_card_class(@truck_load) }}&gt;
      &lt;Grid type="row"&gt;
        &lt;CardHeader
          :if={{ not is_nil(@truck_load.sand_type) }}
          background_color={{ @truck_load.sand_type_background_color }}
          text_color={{ @truck_load.sand_type_text_color }}
          title={{ @truck_load.sand_type }}
          info={{ render_measured_weight_info(@truck_load.measured_weight) }}
        /&gt;
        &lt;Grid type="column" opts={{ [large: 7] }} class="DispatchCard-info"&gt;
          &lt;CardInfo
            label="Truck Number"
            title={{ "#{@truck_load.driver_first_name} #{@truck_load.driver_last_name}" }}
            info={{ "##{@truck_load.truck_number}" }}
          /&gt;
          &lt;CardInfo label="Carrier" title={{ @truck_load.carrier_name }} small /&gt;
          &lt;CardInfo
            label="Phone"
            title={{ Formatters.format_phone_number(@truck_load.driver_phone_number) }}
            small
          /&gt;
          &lt;CardInfo label="Trailer" title={{ Shared.get_string(@truck_load.trailer_type, :name) }} small /&gt;
          &lt;CardInfo label="Pull Point" title={{ @truck_load.pull_point_name }} small /&gt;
          &lt;button type="button" class="rev-Button rev-Button--secondary rev-Button--tiny"  click="show_driver_availability_info" phx-target={{ @show_driver_avail_info? }}&gt;See Driver Availability Info&lt;/button&gt;
          &lt;CardInfo :if={{ @show_driver_avail_info? }} label="Time Since Available" title={{ get_time_since_available(@truck_load) }}  small /&gt;
          &lt;CardInfo :if={{ @show_driver_avail_info? }} label="Current Status" title={{ get_driver_current_status(@truck_load) }} small /&gt;
          &lt;CardInfo :if={{ @show_driver_avail_info? }} label="Time Until Cycle Reset" title={{ get_time_until_cycle_reset(@truck_load) }} small /&gt;
          &lt;CardStatTripTime
            id={{ "trip_time_card_#{@truck_load.id}" }}
            trip_time={{ @trip_time }}
            has_active_fulfillment={{ active_fulfillment?(assigns) }}
          /&gt;
        &lt;/Grid&gt;
        &lt;Grid type="column" opts={{ [large: 5] }} class="DispatchCard-info"&gt;
          &lt;CardStat
            title={{ TSSWeb.TruckLoadView.event_badge(@truck_load) }}
            label="Time Elapsed"
            value={{ get_time_elapsed(@truck_load) }}
            icon="clock"
          /&gt;
          &lt;CardStat
            :if={{ show_old_eta?(assigns, :current_leg) }}
            label="Current Leg"
            icon="watch"
            value={{ eta_value(@current_leg_eta) }}
            alert={{ eta_alert(@current_leg_eta) }}
            tooltip={{ eta_tooltip(@current_leg_eta) }}
          /&gt;
          &lt;CardStat
            :if={{ show_old_eta?(assigns, :total_eta) }}
            label="Total"
            icon="watch"
            value={{ eta_value(@total_eta) }}
            alert={{ eta_alert(@total_eta) }}
            tooltip={{ eta_tooltip(@total_eta) }}
          /&gt;
          &lt;CardStat
            :if={{ @truck_load.bol_status }}
            icon="file-text"
            label="BOL"
            value="BOL"
            class={{ bol_class(@truck_load) }}
          /&gt;
          &lt;CardStat
            icon="user"
            label="Driver Duty Status"
            value={{ Recase.to_title(@truck_load.driver_duty_status) }}
          /&gt;
          &lt;CardStat
            :if={{ show_trip_break?(@truck_load.current_trip_break) }}
            icon={{ trip_break_icon(@truck_load.current_trip_break) }}
            label={{ trip_break_label(@truck_load.current_trip_break) }}
            value={{ trip_break_value(@truck_load.current_trip_break) }}
          /&gt;
        &lt;/Grid&gt;
      &lt;/Grid&gt;
      &lt;div class="rev-Card-footer"&gt;
        &lt;Grid type="row" class="DispatchCard-footer"&gt;
          &lt;Grid type="column" opts={{ [small: 9] }} class="u-flexAlignStart"&gt;
            &lt;CardFooterLink
              :if={{ @show_start_over_button? }}
              to={{Routes.live_path(TSSWeb.Endpoint, TSSWeb.DispatchHomeLive.AddTruckLoad, @well.id,
                truck_load_id: @truck_load.id
              )}}
              title="Start Over"
              icon="arrow-left-circle"
            /&gt;
            &lt;CardFooterLink
              :if={{ @show_change_pp_button? }}
              title="Change Pull Point"
              click="change_procurement_modal:on_open"
              truck_load_id={{ @truck_load.id }}
              icon="arrow-up-circle"
              class="ProcurementModal"
            /&gt;
            &lt;CardFooterLink
              :if={{ @show_reroute_button? &amp;&amp; active_fulfillment?(assigns) }}
              title="Reroute"
              click="reroute_truck_load_modal:on_open"
              truck_load_id={{ @truck_load.id }}
              icon="refresh-cw"
            /&gt;
            &lt;CardFooterLink
              :if={{ @truck_load.can_cancel? }}
              click="cancel_truck_load"
              truck_load_id={{ @truck_load.id }}
              title="Cancel"
              confirm="You cannot undo this action. Are you sure you want to CANCEL AND PERMANENTLY DELETE this truckload? Your name will be tied to the deleted truckload for tracking and user management purposes."
              icon="x-circle"
            /&gt;
            &lt;CardFooterLink
              :if={{ get_in(@truck_load, [:current_trip_break, :type]) == "break" }}
              title="Resume"
              click="end_trip_break"
              truck_load_id={{ @truck_load.id }}
              icon="play-circle"
            /&gt;
            &lt;CardFooterLink
              :if={{ get_in(@truck_load, [:current_trip_break, :type]) == "breakdown" }}
              title="Report Truck Back Up"
              click="end_trip_break"
              truck_load_id={{ @truck_load.id }}
              icon="play-circle"
            /&gt;
            &lt;CardFooterLink
              :if={{ is_nil(get_in(@truck_load, [:current_trip_break, :type])) }}
              title="Pause"
              click="trip_break_modal:on_open"
              truck_load_id={{ @truck_load.id }}
              icon="pause-circle"
            /&gt;
            &lt;CardFooterLink
              :if={{ is_nil(get_in(@truck_load, [:current_trip_break, :type])) }}
              title="Report Truck Down"
              click="report_truck_down"
              truck_load_id={{ @truck_load.id }}
              icon="alert-circle"
            /&gt;
            &lt;CardFooterLink
              :if={{ @show_drop_trailer_button? &amp;&amp; @truck_load.status == "trailer_dropped" }}
              to={{ Routes.live_path(TSSWeb.Endpoint, TSSWeb.DispatchHomeLive.RequestTrailerPickup, @truck_load.id) }}
              title="Request Trailer Pickup"
              truck_load_id={{ @truck_load.id }}
              icon="upload"
            /&gt;
            &lt;CardFooterLink
              :if={{ @show_drop_trailer_button? &amp;&amp; @truck_load.status == "pickup_requested" }}
              title="Trailer Picked Up"
              icon="upload"
              click="dropped_trailer:trailer_picked_up"
              confirm="Are you sure you want to mark this trailer as picked up?"
              truck_load_id={{ @truck_load.id }}
            /&gt;
            &lt;CardFooterLink
              :if={{ @show_drop_trailer_button? &amp;&amp; @truck_load.status not in ["pickup_requested", "trailer_dropped"] }}
              title="Drop Trailer"
              icon="download"
              click="dropped_trailer:drop_trailer"
              confirm="Are you sure you want to mark this trailer as dropped?"
              truck_load_id={{ @truck_load.id }}
            /&gt;
            &lt;CardFooterLink
              :if={{ @show_call_to_well_button? and Calls.can_call?(@truck_load) }}
              title="Call To Well"
              confirm="Are you sure you want to call this driver to the well?"
              click="call_to_well:call"
              truck_load_id={{ @truck_load.id }}
              disabled={{ !show_call_to_well?(@truck_load) }}
              icon="phone"
            /&gt;
            &lt;CardFooterLink
              to={{ Routes.live_path(TSSWeb.Endpoint, TSSWeb.DispatchHomeLive.SlipSeatModal, @truck_load.id) }}
              title="Slip Seat"
              icon="shuffle"
            /&gt;
            &lt;CardFooterLink
              :if={{ @show_unload_button? }}
              to={{ Routes.live_path(TSSWeb.Endpoint, TSSWeb.DispatchHomeLive.UnloadModal, @truck_load.id) }}
              title="Unload"
              icon="check-square"
            /&gt;
          &lt;/Grid&gt;
          &lt;Grid type="column" opts={{ [small: 3] }}&gt;
            &lt;a
              href={{Routes.live_path(TSSWeb.Endpoint, TSSWeb.DispatchHomeLive.ViewTruckLoad, @well.id, @truck_load.id,
                referrer: Routes.live_path(TSSWeb.Endpoint, TSSWeb.DispatchHomeLive, @well.id, landing: :kanban)
              )}}
              title="View Details"
              class="DispatchCard-footerLink"
            &gt;#{{ @truck_load.id }}&lt;/a&gt;
          &lt;/Grid&gt;
        &lt;/Grid&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    """
  end

  defp render_measured_weight_info(nil), do: ""

  defp render_measured_weight_info(weight) do
    measured_weight_lbs = Formatters.format_as_pounds(weight)
    measured_weight_tons = Weight.convert_pounds_to_tons_and_round(weight, 2)
    "#{measured_weight_lbs} lbs (#{measured_weight_tons} tons) "
  end

  defp active_fulfillment?(%{truck_load: %{active_fulfillment: nil}}), do: false
  defp active_fulfillment?(_), do: true

  defp show_call_to_well?(truck_load) do
    latest_call_status = Calls.latest_call_status(truck_load)
    is_nil(latest_call_status) || latest_call_status == "unskipped"
  end

  defp show_trip_break?(nil), do: false
  defp show_trip_break?(%{expected_duration: nil, type: "break"}), do: false
  defp show_trip_break?(_), do: true

  defp trip_break_label(%{type: "breakdown"}), do: "Time down"
  defp trip_break_label(_), do: "Time on break"

  defp trip_break_icon(%{type: "breakdown"}), do: "alert-circle"
  defp trip_break_icon(_), do: "pause-circle"

  defp trip_break_value(nil), do: nil

  defp trip_break_value(%{expected_duration: nil, type: "break"}), do: nil

  defp trip_break_value(%{type: "breakdown", started_at: started_at}) do
    started_at
    |&gt; Timezone.diff_current_time_in_minutes()
    |&gt; abs()
    |&gt; format_minutes()
  end

  defp trip_break_value(%{expected_duration: expected_duration, started_at: started_at}) do
    mins_since_start = started_at |&gt; Timezone.diff_current_time_in_minutes() |&gt; abs()
    remaining_time = expected_duration - mins_since_start

    if remaining_time &lt; 0 do
      format_minutes(0)
    else
      format_minutes(remaining_time)
    end
  end

  defp format_minutes(minutes) do
    Formatters.humanize_time(minutes, :minutes, :minutes) &lt;&gt; " (hh:mm)"
  end

  defp bol_class(%{bol_status: bol_status}) do
    "DispatchCard-iconStat--#{bol_status}"
  end

  defp show_old_eta?(%{current_leg_eta: %{eta: eta}} = assigns, :current_leg)
       when not is_nil(eta) do
    active_fulfillment?(assigns)
  end

  defp show_old_eta?(%{total_eta: %{eta: eta}} = assigns, :total_eta)
       when not is_nil(eta) do
    active_fulfillment?(assigns)
  end

  defp show_old_eta?(_, _), do: false

  defp eta_value(%{text: text}), do: "#{text} (hh:mm)"
  defp eta_value(_), do: nil

  defp eta_alert(%{driver_idle?: driver_idle?}), do: driver_idle?
  defp eta_alert(_), do: nil

  defp eta_tooltip(%{tooltip: tooltip}), do: tooltip
  defp eta_tooltip(_), do: nil

  defp get_time_elapsed(truck_load) do
    time_elapsed = TSSWeb.DispatchHome.View.get_time_elapsed_since_entered_column(truck_load)

    "#{time_elapsed} (hh:mm)"
  end

  defp get_time_since_available(truck_load) do
    driver = TSS.DriverStatuses.get_driver_by_driver_id(truck_load.driver_id)

    if !is_nil(driver) do
      time_elapsed = Formatters.decorate_time_since_available(driver)
      "#{time_elapsed}"
    else
      "driver not available"
    end
  end

  defp get_driver_current_status(truck_load) do
    driver = TSS.DriverStatuses.get_driver_status_by_driver_id(truck_load.driver_id)

    if !is_nil(driver) do
      status = Formatters.decorate_driver_current_status(driver)
      "#{status}"
    else
      "driver not available"
    end
  end

  defp get_time_until_cycle_reset(truck_load) do
    driver = TSS.DriverStatuses.get_driver_status_by_driver_id(truck_load.driver_id)
    remaining_cycle_time = Formatters.decorate_remaining_cycle_time(driver)

    "#{remaining_cycle_time}"
  end

  defp dispatch_card_class(truck_load) do
    default_class = "DispatchCard rev-Card"

    if is_nil(truck_load.current_trip_break) do
      "#{default_class} DispatchCard-status--#{truck_load.status}"
    else
      "#{default_class} DispatchCard-status--#{truck_load.current_trip_break.type}"
    end
  end
end
</code></pre>
<p>And this is <code>DispatchHomeLive </code> where the <code>handle_event</code> is (all the other <code>handle_event</code>’s for components in the <code>kanban_card_component.ex</code> file are in here and working fine, which is why I believe this <code>handle_event</code>  belongs here…I tried moving it to the actual <code>DispatchHomeLive </code> component and still got the same <code>[error] GenServer #PID&lt;0.1218.0&gt; terminating ** (UndefinedFunctionError) function TSSWeb.DispatchHomeLive.handle_event/3 is undefined or private </code> error) :</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule TSSWeb.DispatchHomeLive.Kanban.Component do
  @moduledoc """
  Renders the kanban board / "Active truck loads" tab on the Dispatch Board of a
  given well.

  "Active" means any truckload that has had a job request sent and is not yet
  unloaded.
  """
  use TSSWeb, :live_component

  alias TSSWeb.{
    DispatchHomeLive.ActionValidators,
    DispatchHomeLive.RerouteTruckLoadModal,
    DispatchHomeLive.ChangeProcurementModal,
    DispatchHomeLive.DroppedTrailer,
    DispatchHomeLive.CallToWell,
    DispatchHomeLive.TripBreakModal,
    DispatchHome
  }

  alias TSS.{
    DispatchOrders,
    TruckLoad,
    TruckLoads,
    TruckLoads.Calls,
    TripBreak,
    TripBreaks,
    Orders,
    Order
  }

  @init_assigns %{
    truck_loads: [],
    truck_load: nil,
    modal_assigns: nil,
    dispatched_loads: [],
    loaded_loads: [],
    on_site_loads: [],
    scheduled: [],
    # a hidden/unused field to allow for re-rendering manually:
    last_updated_timestamp: nil,
    # A map of truck_load ids =&gt; eta timestamps
    load_etas: %{},
    reroute_truck_load_modal_open?: false,
    well_options: [],
    procurement_modal_open?: false,
    trip_break_modal_open?: false,
    procurement_options: [],
    show_driver_avail_info?: false
  }

  def render(assigns) do
    Phoenix.View.render(DispatchHome.View, "kanban.html", assigns)
  end

  def update(
        %{
          data: data,
          well: well,
          show?: show?,
          current_user: current_user
        },
        socket
      ) do
    socket =
      socket
      |&gt; init_assigns(@init_assigns)
      |&gt; assign_data(data)
      |&gt; assign(:well, well)
      |&gt; assign(:show?, show?)
      |&gt; assign(:current_user, current_user)

    {:ok, socket}
  end

  defp assign_data(socket, nil), do: socket
  defp assign_data(socket, data), do: assign(socket, data)

  def handle_event("reroute_truck_load_modal:" &lt;&gt; action, attrs, socket) do
    RerouteTruckLoadModal.Actions.handle_event(action, attrs, socket)
  end

  def handle_event("dropped_trailer:" &lt;&gt; action, attrs, socket) do
    DroppedTrailer.Actions.handle_event(action, attrs, socket)
  end

  def handle_event("call_to_well:" &lt;&gt; action, attrs, socket) do
    CallToWell.Actions.handle_event(action, attrs, socket)
  end

  def handle_event("change_procurement_modal:" &lt;&gt; action, attrs, socket) do
    ChangeProcurementModal.Actions.handle_event(action, attrs, socket)
  end

  def handle_event("trip_break_modal:" &lt;&gt; action, attrs, socket) do
    TripBreakModal.Actions.handle_event(action, attrs, socket)
  end

  def handle_event(
        "report_truck_down",
        %{"truck-load-id" =&gt; truck_load_id},
        %{assigns: %{current_user: user}} = socket
      ) do
    truck_load = TruckLoads.get_truck_load!(truck_load_id)

    ActionValidators.validate_user_current_location_for_trip_break(
      truck_load,
      "breakdown",
      socket,
      fn user_current_location -&gt;
        attrs =
          TripBreaks.append_coords_to_trip_break_attrs(
            %{
              truck_load_id: truck_load.id,
              driver_id: truck_load.driver_id,
              creator_id: user.id,
              type: "breakdown",
              started_at: DateTime.utc_now()
            },
            user_current_location
          )

        case TripBreaks.create_trip_break(attrs) do
          {:error, _changeset} -&gt;
            {:noreply,
             put_flash(socket, :error, "Error Reporting Truckload ##{truck_load_id} down!")}

          {:ok, %TripBreak{} = _trip_break} -&gt;
            {:noreply, put_flash(socket, :success, "Truckload ##{truck_load_id} reported down!")}
        end
      end
    )
  end

  def handle_event(
        "end_trip_break",
        %{"truck-load-id" =&gt; truck_load_id},
        socket
      ) do
    trip_break = TripBreaks.get_current_trip_break(truck_load_id)

    case TripBreaks.end_trip_break(trip_break) do
      {:error, _changeset} -&gt;
        {:noreply,
         put_flash(socket, :error, "Error Reporting Truckload ##{truck_load_id} back up!")}

      {:ok, %TripBreak{} = _trip_break} -&gt;
        {:noreply, put_flash(socket, :success, "Truckload ##{truck_load_id} reported back up!")}
    end
  end

  def handle_event(
        "cancel_truck_load",
        %{"truck-load-id" =&gt; truck_load_id},
        %{assigns: %{current_user: user}} = socket
      ) do
    with %TruckLoad{} = truck_load &lt;- TruckLoads.get_truck_load(truck_load_id),
         {:ok, truck_load} &lt;- TruckLoads.cancel_truck_load(truck_load, user) do
      Calls.create_cancelled_call(truck_load, user)
      {:noreply, put_flash(socket, :success, "Truckload ##{truck_load_id} Cancelled!")}
    else
      _ -&gt;
        {:noreply, put_flash(socket, :error, "Error Cancelling Truckload ##{truck_load_id}!")}
    end
  end

  def handle_event(
        "cancel_order",
        %{"order-id" =&gt; order_id},
        %{assigns: %{current_user: user}} = socket
      ) do
    with %Order{} = order &lt;- Orders.get_order(order_id, [:fulfillments]),
         {:ok, %Order{}} &lt;- DispatchOrders.cancel_order(order, user) do
      {:noreply, put_flash(socket, :success, "Truckload Cancelled!")}
    else
      _ -&gt;
        {:noreply, put_flash(socket, :error, "Error Cancelling Truckload!")}
    end
  end

  def handle_event("show_driver_availability_info", _, socket) do
    IO.puts("show_driver_availability_info being called")
    IO.inspect(socket.assigns.show_driver_avail_info?)
    socket = assign(socket, :show_driver_avail_info?, true)
    {:noreply, socket}
  end
end
</code></pre>
<p>Also, this is the <code>kanban.html.leex</code> template file:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">&lt;%= if @show? do %&gt;
  &lt;div id="kanban" class="&lt;%= Shared.suit_class("rev-Row", flex: true, stretch: true, class: "Kanban-wrapper") %&gt;"&gt;
    &lt;%= if render_kanban?(@scheduled, @dispatched, @loaded, @on_site) do %&gt;
      &lt;div class="&lt;%= Shared.suit_class("rev-Col", medium: 3, class: "Kanban-col") %&gt;"&gt;
        &lt;%= render "_kanban_column_header.html",
          [
            name: "Scheduled",
            column_name: "scheduled",
            card_count: Enum.count(@scheduled),
            card_count_changed?: @count_changes.scheduled,
            error_count: 0
          ]
        %&gt;
        &lt;%= live_component @socket, TSSWeb.DispatchHomeLive.Kanban.Column.Component,
            show_reroute_button?: false,
            show_drop_trailer_button?: false,
            show_start_over_button?: true,
            show_change_pp_button?: false,
            show_call_to_well_button?: false,
            show_unload_button?: false,
            truck_load_etas: @load_etas,
            truck_loads: [],
            orders: @scheduled,
            well: @well,
            show_driver_avail_info?: @show_driver_avail_info?
        %&gt;
      &lt;/div&gt;
      &lt;div class="&lt;%= Shared.suit_class("rev-Col", medium: 3, class: "Kanban-col") %&gt;"&gt;
        &lt;%= render "_kanban_column_header.html",
          [
            name: "Dispatched",
            column_name: "dispatched",
            card_count: Enum.count(@dispatched),
            card_count_changed?: @count_changes.dispatched,
            error_count: get_kanban_column_error_count(@dispatched)
          ]
        %&gt;
        &lt;%= live_component @socket, TSSWeb.DispatchHomeLive.Kanban.Column.Component,
            show_reroute_button?: false,
            show_drop_trailer_button?: false,
            show_start_over_button?: false,
            show_change_pp_button?: true,
            show_call_to_well_button?: false,
            show_unload_button?: false,
            truck_load_etas: @load_etas,
            truck_loads: @dispatched,
            orders: [],
            well: @well,
            show_driver_avail_info?: @show_driver_avail_info?
        %&gt;
      &lt;/div&gt;
      &lt;div class="&lt;%= Shared.suit_class("rev-Col", medium: 3, class: "Kanban-col") %&gt;"&gt;
        &lt;%= render "_kanban_column_header.html",
          [
            name: "loaded",
            column_name: "loaded",
            card_count: Enum.count(@loaded),
            card_count_changed?: @count_changes.loaded,
            error_count: get_kanban_column_error_count(@loaded)
          ]
        %&gt;
        &lt;%= live_component @socket, TSSWeb.DispatchHomeLive.Kanban.Column.Component,
            show_reroute_button?: true,
            show_drop_trailer_button?: true,
            show_start_over_button?: false,
            show_change_pp_button?: false,
            show_call_to_well_button?: false,
            show_unload_button?: false,
            truck_load_etas: @load_etas,
            truck_loads: @loaded,
            orders: [],
            well: @well,
            show_driver_avail_info?: @show_driver_avail_info?
        %&gt;
      &lt;/div&gt;
      &lt;div class="&lt;%= Shared.suit_class("rev-Col", medium: 3, class: "Kanban-col") %&gt;"&gt;
        &lt;%= render "_kanban_column_header.html",
          [
            name: "On Site",
            column_name: "on_site",
            card_count: Enum.count(@on_site),
            card_count_changed?: @count_changes.on_site,
            error_count: get_kanban_column_error_count(@on_site)
          ]
        %&gt;
        &lt;%= live_component @socket, TSSWeb.DispatchHomeLive.Kanban.Column.Component,
            show_reroute_button?: true,
            show_drop_trailer_button?: true,
            show_start_over_button?: false,
            show_change_pp_button?: false,
            show_call_to_well_button?: true,
            show_unload_button?: true,
            truck_load_etas: @load_etas,
            truck_loads: @on_site,
            orders: [],
            well: @well,
            show_driver_avail_info?: @show_driver_avail_info?
        %&gt;
      &lt;/div&gt;
    &lt;% else %&gt;
      &lt;div class="rev-Col"&gt;
        &lt;div class="EmptyState EmptyState--borderless u-flexVerticalAlignCenter"&gt;
          &lt;div&gt;&lt;%= Shared.icon "alert-circle", class: "EmptyState-icon" %&gt;&lt;/div&gt;
          There are no trucks currently dispatched to this well. Click 'Add Load' at the top of the page to dispatch a truck.
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
    &lt;%= if @reroute_truck_load_modal_open? do %&gt;
      &lt;%= render "_reroute_truck_load_modal.html", assigns %&gt;
    &lt;% end %&gt;
    &lt;%= if @procurement_modal_open? do %&gt;
      &lt;%= render "_change_procurement_modal.html", assigns %&gt;
    &lt;% end %&gt;
    &lt;%= if @trip_break_modal_open? do %&gt;
      &lt;%= render "_trip_break_modal.html", assigns %&gt;
    &lt;% end %&gt;
  &lt;/div&gt;
&lt;% else %&gt;
  &lt;div id="kanban"&gt;&lt;/div&gt;
&lt;% end %&gt;

</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="213168" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/function-not-being-called-on-button-click/39489/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-213168" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="213168"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="213180" data-post-id="213180">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="APB9785" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/APB9785/120/24101_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  APB9785
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of ECSx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>In the code you posted, I’m seeing the button as</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">&lt;button ... click="show_driver_availability_info" phx-target={{ @show_driver_avail_info? }}&gt;See Driver Availability Info&lt;/button&gt;
</code></pre>
<p>If this is something Surface-related that I don’t understand, then I apologize in advance, but this doesn’t seem right to me.  For a Phoenix callback, you should be using <code>phx-click</code>, and the target should be <code>@myself</code> to reference the LiveView process, not a boolean value.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="213180" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/function-not-being-called-on-button-click/39489/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-213180" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="213180"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="213181" data-post-id="213181">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="learning123" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  learning123
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>So for Surface, you have to do the click a little differently, using <code>phx-click</code> wasn’t working.<br>
I believe you have to set the click function like this: <code>:on-click="show_driver_availability_info"}</code> and this works, but I’m not sure how to set the target correctly and the Surface docs aren’t really helping…just doing <code>  target={{ @myself }</code> like you would in LiveView doesn’t work, and I’ve tried other ways but haven’t been able to get it, I’m console logging the button’s <code>value</code> and it keeps coming back empty.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="213181" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/function-not-being-called-on-button-click/39489/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-213181" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="213181"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="213223" data-post-id="213223">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="learning123" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  learning123
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>According to some people in the Elixir slack, the <code>phx-value-</code> prefix should be used to pass the value along, so, this is what I have now,</p>
<p>The button looks like this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">&lt;button type="button" class="rv-Button--tiny" :on-click="show_driver_availability_info"  phx-value-show_driver_avail_info={{ @show_driver_avail_info? }}&gt;See Driver Availability Info&lt;/button&gt;
</code></pre>
<p>Here’s the <code>event_handler</code>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  def handle_event(
        "show_driver_availability_info",
        %{"show_driver_avail_info" =&gt; show_driver_avail_info?},
        socket
      ) do
    IO.puts("show_driver_availability_info being called")
    socket = assign(socket, :show_driver_avail_info?, true)
    {:noreply, socket}
  end
</code></pre>
<p>And when the button is clicked, this is the error I’m getting:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"> (FunctionClauseError) no function clause matching in TSSWeb.DispatchHomeLive.handle_event/3
    (tss 0.0.1) lib/tss_web/live/dispatch_home_live/dispatch_home_live.ex:406: TSSWeb.DispatchHomeLive.handle_event("show_driver_availability_info", %{"value" =&gt; ""}, #Phoenix.LiveView.Socket&lt;assigns: %{__context__: %{}, __surface__: %{}, breadcrumb_trail: [[name: "Home", url: "/"], [name: "Wells", url: "/wells_board"], [name: "Dispatch Board - Argent Barksdale East 29-17 4LS/4WA/6LS/6WA/7LS/7WA", ...]], connected?: true, current_user: %TSS.User{last_signed_in_at: ~U[2021-02-22 15:45:09.535722Z], password: "$2b$12$deK4g0VNl2lJPNKlTRfoSeapIceDCWb/axPDlexmTV.iNvQL/jXDS", ...}, flash: %{}, forecast_data: %{...}, ...}, changed: %{}, endpoint: TSSWeb.Endpoint, id: "phx-Fn21s0dRpOhSdzwh", parent_pid: nil, root_pid: #PID&lt;0.6038.0&gt;, router: TSSWeb.Router, view: TSSWeb.DispatchHomeLive, ...&gt;)
</code></pre>
<p>The “value” is still empty, am I passing it along correctly?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="213223" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/function-not-being-called-on-button-click/39489/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-213223" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="213223"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="213232" data-post-id="213232">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="msaraiva" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/msaraiva/120/1214_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  msaraiva
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Broadway Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi <a class="mention" href="/u/learning123" rel="nofollow">@learning123</a>!</p>
<aside class="quote no-group" data-username="learning123" data-post="15" data-topic="39489">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/l/c6cbf5/48.png" class="avatar"> learning123:</div>
<blockquote>
<p>The “value” is still empty, am I passing it along correctly?</p>
</blockquote>
</aside>
<p>The value is empty because <code>show_driver_avail_info?</code> is false. The thing is that HTML does not support real boolean attribute values. Any value is converted to string. The only way we have to mimic the behaviour of a boolean value in HTML is by suppressing the attribute definition itself. So whenever you pass a boolean value to an HTML attribute, that attribute is only rendered if the value is truthy. That allows you to pass boolean values directly in the template e.g. <code>disabled={{ @disabled }}</code>.</p>
<p>So you have two options:</p>
<ol>
<li>Instead of pattern matching expecting the presence of a <code>"show_driver_avail_info"</code> key, you accept the value without that key and check it’s defined or not.</li>
<li>Always pass a value by converting the boolean into a string, e.g. <code>phx-value-show_driver_avail_info={{ to_string(@show_driver_avail_info?) }}</code>. Is this case you can keep the <code>"show_driver_avail_info"</code> key in the pattern but test if the the value is the string representation of the boolean value, i.e. <code>"true"</code> or <code>"false"</code> instead of <code>true</code> or <code>false</code>.</li>
</ol> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="213232" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/function-not-being-called-on-button-click/39489/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-213232" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="213232"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="213235" data-post-id="213235">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="learning123" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  learning123
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thank you <a class="mention" href="/u/msaraiva" rel="nofollow">@msaraiva</a>!</p>
<p>So, if I wanted to go with the second option, this is how I have the component that should be rendered when the button is clicked and <code>show_driver_avail_info</code> becomes <code>"true"</code>:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">&lt;CardInfo :if={{ @show_driver_avail_info? == "true" }} label="Time Since Available" title={{ get_time_since_available(@truck_load) }}  small /&gt;
</code></pre>
<p>When I do this, I don’t get an error, but the<code> &lt;CardInfo /&gt;</code> component still doesn’t show up. Is there something wrong with my <code>handle_event</code> function? It looks like this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  def handle_event(
        "show_driver_availability_info",
        %{"show_driver_avail_info?" =&gt; show_driver_avail_info?},
        socket
      ) do
    IO.puts("show_driver_availability_info being called")
    socket = assign(socket, :show_driver_avail_info?, true)
    {:noreply, socket}
  end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="213235" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/function-not-being-called-on-button-click/39489/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-213235" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="213235"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="213239" data-post-id="213239">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="msaraiva" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/msaraiva/120/1214_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  msaraiva
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Broadway Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The component doesn’t show up because <code>@show_driver_avail_info?</code> is still a boolean and its value is either <code>false</code> (on initialization) or <code>true</code> (after clicking), never the string <code>"true"</code>. Pay attention that you can keep the assign as a boolean as long as you treat the received values in the event handler as strings. Liveview only accepts string values as event parameters. You cannot send boolean nor integer values to events. They’ll always be converted into strings so just handle them as such in the <code>handle_event</code>. The rule is simple:</p>
<ol>
<li>Event params come from the browser so they are always serialized as strings.</li>
<li>Socket assigns are kept in the server so their values are exactly the same thing you set them to be, e.g. integer, boolean, map, list, etc.</li>
</ol> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="213239" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/function-not-being-called-on-button-click/39489/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-213239" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="213239"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>