@@ -44,7 +44,7 @@ defmodule AlgoraWeb.Org.JobLive do
44
44
end
45
45
46
46
@ impl true
47
- def mount ( % { "org_handle" => handle , "id" => id , "tab" => tab } , _session , socket ) do
47
+ def mount ( % { "org_handle" => handle , "id" => id } , _session , socket ) do
48
48
case Jobs . get_job_posting ( id ) do
49
49
{ :ok , job } ->
50
50
if job . user_id == socket . assigns . current_org . id do
@@ -60,7 +60,6 @@ defmodule AlgoraWeb.Org.JobLive do
60
60
|> assign ( :show_share_drawer , false )
61
61
|> assign ( :show_payment_drawer , false )
62
62
|> assign ( :payment_form , to_form ( % { "payment_type" => "stripe" } , as: :payment ) )
63
- |> assign ( :current_tab , tab )
64
63
|> assign ( :bounty_form , to_form ( BountyForm . changeset ( % BountyForm { } , % { } ) ) )
65
64
|> assign ( :tip_form , to_form ( TipForm . changeset ( % TipForm { } , % { } ) ) )
66
65
|> assign ( :contract_form , to_form ( ContractForm . changeset ( % ContractForm { } , % { } ) ) )
@@ -96,17 +95,14 @@ defmodule AlgoraWeb.Org.JobLive do
96
95
end
97
96
end
98
97
99
- @ impl true
100
- def mount ( % { "org_handle" => handle , "id" => id } , _session , socket ) do
101
- { :ok , push_navigate ( socket , to: ~p" /#{ handle } /jobs/#{ id } /#{ default_tab ( ) } " ) }
102
- end
103
-
104
98
@ impl true
105
99
def handle_params ( % { "tab" => "activate" } , _uri , socket ) do
106
- { :noreply ,
107
- socket
108
- |> assign ( :current_tab , default_tab ( ) )
109
- |> assign ( :show_payment_drawer , true ) }
100
+ socket =
101
+ if socket . assigns . current_org . subscription_price ,
102
+ do: assign ( socket , :show_payment_drawer , true ) ,
103
+ else: redirect ( socket , external: AlgoraWeb.Constants . get ( :calendar_url ) )
104
+
105
+ { :noreply , assign_new ( socket , :current_tab , fn -> default_tab ( ) end ) }
110
106
end
111
107
112
108
@ impl true
@@ -121,6 +117,11 @@ defmodule AlgoraWeb.Org.JobLive do
121
117
{ :noreply , assign ( socket , :current_tab , tab ) }
122
118
end
123
119
120
+ @ impl true
121
+ def handle_params ( % { "org_handle" => handle , "id" => id } , _uri , socket ) do
122
+ { :noreply , push_navigate ( socket , to: ~p" /#{ handle } /jobs/#{ id } /#{ default_tab ( ) } " ) }
123
+ end
124
+
124
125
@ impl true
125
126
def render ( assigns ) do
126
127
~H"""
@@ -241,12 +242,9 @@ defmodule AlgoraWeb.Org.JobLive do
241
242
<% "applicants" -> %>
242
243
< . section title = "Applicants " subtitle = "Developers who applied for this position " >
243
244
<: actions >
244
- < . button variant = "secondary " phx-click = "toggle_import_drawer " >
245
+ < . button variant = "default " phx-click = "toggle_import_drawer " >
245
246
Import
246
247
</ . button >
247
- < . button variant = "default " phx-click = "screen_applicants " >
248
- Screen
249
- </ . button >
250
248
</: actions >
251
249
<%= if Enum . empty? ( @ applicants ) do %>
252
250
< . card class = "rounded-lg bg-card py-12 text-center lg:rounded-[2rem] " >
@@ -314,8 +312,8 @@ defmodule AlgoraWeb.Org.JobLive do
314
312
<% "matches" - > %>
315
313
< . section title = "Matches " subtitle = "Top developers matching your requirements " >
316
314
<: actions >
317
- < . button variant = "default " phx-click = "screen_applicants " >
318
- Screen
315
+ < . button variant = "default " phx-click = "toggle_import_drawer " >
316
+ Import
319
317
</ . button >
320
318
</: actions >
321
319
<%= if Enum . empty? ( @ matches ) do %>
@@ -409,7 +407,7 @@ defmodule AlgoraWeb.Org.JobLive do
409
407
</ div >
410
408
< div class = "flex flex-col justify-center items-center text-center " >
411
409
< . button
412
- phx-click = "toggle_payment_drawer "
410
+ phx-click = "show_payment_drawer "
413
411
variant = "none "
414
412
class = "group bg-emerald-900/10 text-emerald-300 transition-colors duration-75 hover:bg-emerald-800/10 hover:text-emerald-300 hover:drop-shadow-[0_1px_5px_#34d39980] focus:bg-emerald-800/10 focus:text-emerald-300 focus:outline-none focus:drop-shadow-[0_1px_5px_#34d39980] border border-emerald-400/40 hover:border-emerald-400/50 focus:border-emerald-400/50 h-[8rem] "
415
413
size = "xl "
@@ -536,13 +534,8 @@ defmodule AlgoraWeb.Org.JobLive do
536
534
end
537
535
538
536
@ impl true
539
- def handle_event ( "toggle_payment_drawer" , _ , socket ) do
540
- socket =
541
- if socket . assigns . current_org . subscription_price ,
542
- do: assign ( socket , :show_payment_drawer , ! socket . assigns . show_payment_drawer ) ,
543
- else: redirect ( socket , external: AlgoraWeb.Constants . get ( :calendar_url ) )
544
-
545
- { :noreply , socket }
537
+ def handle_event ( "show_payment_drawer" , _ , socket ) do
538
+ { :noreply , push_patch ( socket , to: ~p" /#{ socket . assigns . job . user . handle } /jobs/#{ socket . assigns . job . id } /activate" ) }
546
539
end
547
540
548
541
@ impl true
@@ -673,7 +666,10 @@ defmodule AlgoraWeb.Org.JobLive do
673
666
674
667
@ impl true
675
668
def handle_event ( "close_payment_drawer" , _ , socket ) do
676
- { :noreply , assign ( socket , :show_payment_drawer , false ) }
669
+ { :noreply ,
670
+ socket
671
+ |> assign ( :show_payment_drawer , false )
672
+ |> push_patch ( to: ~p" /#{ socket . assigns . job . user . handle } /jobs/#{ socket . assigns . job . id } /#{ socket . assigns . current_tab } " ) }
677
673
end
678
674
679
675
@ impl true
0 commit comments