Skip to content
Open
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
14 changes: 13 additions & 1 deletion lib/parzival_web/live/app/profile_live/form_component.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ defmodule ParzivalWeb.App.ProfileLive.FormComponent do

alias Parzival.Accounts
alias Parzival.Accounts.User
alias Parzival.Companies

@extensions_whitelist ~w(.jpg .jpeg .gif .png)
@cycles [:Bachelors, :Masters, :Phd]
Expand All @@ -27,7 +28,8 @@ defmodule ParzivalWeb.App.ProfileLive.FormComponent do
|> assign(assigns)
|> assign(:user, user)
|> assign(:cycles, @cycles)
|> assign(:changeset, changeset)}
|> assign(:changeset, changeset)
|> assign(list_companies(assigns))}
end

@impl true
Expand Down Expand Up @@ -98,4 +100,14 @@ defmodule ParzivalWeb.App.ProfileLive.FormComponent do
{:ok, user}
end
end

defp list_companies(params) do
case Companies.list_companies(params) do
{:ok, {companies, _meta}} ->
%{companies: companies}

{:error, _flop} ->
%{companies: []}
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@
<%= text_input(f, :website, class: "mt-1 focus:ring-red-500 focus:border-red-500 block w-full shadow-sm text-sm border-gray-300 rounded-md") %>
</dd>
</div>
<%= if @role in [:recruiter] && @current_user.role in [:admin] do %>
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">Company</dt>
<dd class="flex flex-row gap-x-4 mt-1 text-sm text-gray-900">
<%= select(f, :company_id, Enum.map(@companies, &{&1.name, &1.id}), prompt: "Choose a Sponsorship Level", selected: f.data.company_id, class: "mt-1 focus:ring-red-500 focus:border-red-500 block w-full shadow-sm text-sm border-gray-300 rounded-md") %>
</dd>
</div>
<% end %>
</dl>
<dl class="grid grid-cols-1 gap-4 py-6 px-4 border-b border-gray-200 sm:grid-cols-2 sm:px-6 lg:px-8">
<div class="sm:col-span-1">
Expand Down
2 changes: 1 addition & 1 deletion lib/parzival_web/live/backoffice/accounts/user_live/new.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule ParzivalWeb.Backoffice.UserLive.New do
"admin" -> :admin
"staff" -> :staff
"attendee" -> :attendee
"company" -> :company
"recruiter" -> :recruiter
end

{:noreply,
Expand Down