Skip to content

Commit d01552c

Browse files
committed
misc
1 parent fc8ca39 commit d01552c

File tree

1 file changed

+52
-31
lines changed

1 file changed

+52
-31
lines changed

lib/algora_web/live/org/job_live.ex

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -518,22 +518,6 @@ defmodule AlgoraWeb.Org.JobLive do
518518
"""
519519
end
520520

521-
@impl true
522-
def handle_event("activate_subscription", _params, socket) do
523-
case Jobs.create_payment_session(
524-
%{socket.assigns.job | email: socket.assigns.current_user.email},
525-
socket.assigns.current_org.subscription_price
526-
) do
527-
{:ok, url} ->
528-
Algora.Admin.alert("Payment session created for job posting: #{socket.assigns.job.company_name}", :info)
529-
{:noreply, redirect(socket, external: url)}
530-
531-
{:error, reason} ->
532-
Logger.error("Failed to create payment session: #{inspect(reason)}")
533-
{:noreply, put_flash(socket, :error, "Something went wrong. Please try again.")}
534-
end
535-
end
536-
537521
@impl true
538522
def handle_event("toggle_payment_drawer", _, socket) do
539523
socket =
@@ -709,7 +693,7 @@ defmodule AlgoraWeb.Org.JobLive do
709693

710694
{:noreply,
711695
socket
712-
|> put_flash(:info, "We'll send you an invoice via email soon")
696+
|> put_flash(:info, "We'll send you an invoice via email soon!")
713697
|> assign(:show_payment_drawer, false)}
714698

715699
%{valid?: false} = changeset ->
@@ -1535,7 +1519,7 @@ defmodule AlgoraWeb.Org.JobLive do
15351519
<.drawer_header>
15361520
<.drawer_title>Activate Subscription</.drawer_title>
15371521
<.drawer_description>
1538-
Choose your preferred payment method to activate your annual subscription
1522+
Choose your preferred payment method
15391523
</.drawer_description>
15401524
</.drawer_header>
15411525
@@ -1584,7 +1568,7 @@ defmodule AlgoraWeb.Org.JobLive do
15841568
<div class="flex justify-between items-center">
15851569
<span class="text-sm text-muted-foreground">Annual Subscription</span>
15861570
<span class="font-semibold font-display">
1587-
{Money.to_string!(@current_org.subscription_price)}
1571+
{Money.to_string!(price())}
15881572
</span>
15891573
</div>
15901574
<div class="flex justify-between items-center">
@@ -1595,6 +1579,21 @@ defmodule AlgoraWeb.Org.JobLive do
15951579
)}
15961580
</span>
15971581
</div>
1582+
1583+
<div class="flex justify-between items-center">
1584+
<span class="text-sm text-muted-foreground">
1585+
Early Believer Discount:
1586+
</span>
1587+
<span class="font-semibold font-display -ml-1.5">
1588+
-{Money.to_string!(
1589+
Money.sub!(
1590+
price(),
1591+
@current_org.subscription_price
1592+
)
1593+
)}
1594+
</span>
1595+
</div>
1596+
15981597
<div class="border-t pt-4 flex justify-between items-center">
15991598
<span class="font-semibold">Total</span>
16001599
<span class="font-semibold font-display">
@@ -1626,31 +1625,31 @@ defmodule AlgoraWeb.Org.JobLive do
16261625
<.card_content class="pt-0">
16271626
<div class="space-y-4">
16281627
<div class="grid grid-cols-2 gap-2 text-sm">
1629-
<span class="text-muted-foreground">Bank Name:</span>
1628+
<span class="text-muted-foreground">Bank Name</span>
16301629
<span class="font-medium">{@wire_details["bank_name"]}</span>
16311630
1632-
<span class="text-muted-foreground">Account Name:</span>
1631+
<span class="text-muted-foreground">Account Name</span>
16331632
<span class="font-medium">{@wire_details["account_name"]}</span>
16341633
1635-
<span class="text-muted-foreground">Account Number:</span>
1634+
<span class="text-muted-foreground">Account Number</span>
16361635
<span class="font-medium">{@wire_details["account_number"]}</span>
16371636
1638-
<span class="text-muted-foreground">Routing Number:</span>
1637+
<span class="text-muted-foreground">Routing Number</span>
16391638
<span class="font-medium">{@wire_details["routing_number"]}</span>
16401639
1641-
<span class="text-muted-foreground">SWIFT Code:</span>
1640+
<span class="text-muted-foreground">SWIFT Code</span>
16421641
<span class="font-medium">{@wire_details["swift_code"]}</span>
16431642
</div>
16441643
16451644
<div class="border-t pt-4">
16461645
<div class="grid grid-cols-2 gap-2 text-sm">
1647-
<span class="text-muted-foreground">Annual Subscription:</span>
1646+
<span class="text-muted-foreground">Annual Subscription</span>
16481647
<span class="font-medium font-display">
1649-
{Money.to_string!(@current_org.subscription_price)}
1648+
{Money.to_string!(price())}
16501649
</span>
16511650
16521651
<span class="text-muted-foreground line-through block">
1653-
Processing Fee:
1652+
Stripe Processing Fee
16541653
</span>
16551654
<span class="font-medium font-display flex">
16561655
<span class="text-muted-foreground line-through">$0</span>
@@ -1661,15 +1660,35 @@ defmodule AlgoraWeb.Org.JobLive do
16611660
</span>
16621661
</span>
16631662
1664-
<span class="text-muted-foreground">Total:</span>
1665-
<span class="font-medium font-display">
1666-
{Money.to_string!(@current_org.subscription_price)}
1663+
<span class="text-muted-foreground block">
1664+
Early Believer Discount
1665+
</span>
1666+
<span class="font-medium font-display flex">
1667+
<span class="-ml-1.5">
1668+
-{Money.to_string!(
1669+
Money.sub!(
1670+
price(),
1671+
@current_org.subscription_price
1672+
)
1673+
)}
1674+
</span>
16671675
</span>
16681676
</div>
16691677
</div>
16701678
16711679
<div class="border-t pt-4">
1672-
<h4 class="font-medium mb-4">Billing Information</h4>
1680+
<div class="grid grid-cols-2 gap-2 text-sm">
1681+
<span class="text-foreground font-semibold">Total</span>
1682+
<span class="font-semibold font-display">
1683+
{Money.to_string!(@current_org.subscription_price)}
1684+
</span>
1685+
</div>
1686+
</div>
1687+
1688+
<div class="pt-6">
1689+
<h4 class="tracking-tight font-semibold leading-none text-2xl mb-4">
1690+
Billing Details
1691+
</h4>
16731692
<div class="space-y-4">
16741693
<.input
16751694
type="text"
@@ -1731,4 +1750,6 @@ defmodule AlgoraWeb.Org.JobLive do
17311750
</.drawer>
17321751
"""
17331752
end
1753+
1754+
def price, do: Money.new!(:USD, 35_000, no_fraction_if_integer: true)
17341755
end

0 commit comments

Comments
 (0)