Skip to content

Commit

Permalink
Add legacy alerts on pro plan
Browse files Browse the repository at this point in the history
  • Loading branch information
loicknuchel committed Jun 26, 2024
1 parent 7b7c575 commit 1e4a806
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ defmodule AzimuttWeb.OrganizationBillingController do

with {:ok, %Organization{} = organization} <- Organizations.get_organization(organization_id, current_user) do
Organizations.validate_organization_plan(organization)
conn |> redirect(to: Routes.organization_billing_path(conn, :index, organization_id, source: "refresh"))

conn
|> put_flash(:info, "Plan refreshed!")
|> redirect(to: Routes.organization_billing_path(conn, :index, organization_id, source: "refresh"))
end
end

Expand Down
16 changes: 16 additions & 0 deletions backend/lib/azimutt_web/templates/organization/billing.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@
Change you seats using the "Manage your subscription" button.
<% end %>
</p>
<%= if @organization.plan == "pro" do %>
<div class="mt-3 max-w-xl mx-auto rounded bg-yellow-50 p-4">
<div class="flex">
<div class="flex-shrink-0">
<Icon.exclamation_triangle kind="mini" class="h-5 w-5 text-yellow-400" />
</div>
<div class="ml-3">
<h3 class="my-0 text-sm font-medium text-yellow-800">This is a legacy plan.</h3>
<div class="mt-2 text-sm text-yellow-700">
Please migrate to the <a href={Routes.website_path(@conn, :pricing)} target="_blank" class="underline text-yellow-800 hover:text-yellow-900">new ones</a> as mentionned in the email.<br>
You will have to cancel ("Manage your subscription") it and subscribe again.
</div>
</div>
</div>
</div>
<% end %>
<div class="max-w-lg mx-auto">
<%= if length(@subscriptions) > 1 do %>
<div class="mt-3 rounded-md bg-yellow-50 p-4">
Expand Down
17 changes: 17 additions & 0 deletions backend/lib/azimutt_web/templates/organization/show.html.heex
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
<%= if @organization.plan == "pro" do %>
<div class="bg-yellow-50 border-t-4 border-yellow-400 p-4">
<div class="flex">
<div class="flex-shrink-0">
<Icon.exclamation_triangle kind="mini" class="h-5 w-5 text-yellow-400" />
</div>
<div class="ml-3">
<h3 class="my-0 text-sm font-medium text-yellow-800">You are using the legacy Pro plan.</h3>
<div class="mt-2 text-sm text-yellow-700">
Please <a href={Routes.organization_billing_path(@conn, :index, @organization, source: "legacy-alert")} class="underline">migrate to the new plans</a> as mentionned in the email.
</div>
</div>
</div>
</div>
<% end %>

<%= if @projects == [] do %>
<%= render "_project_list_empty.html", conn: @conn, organization: @organization %>
<% else %>
<%= render "_project_list.html", conn: @conn, projects: @projects %>
<% end %>

<% user = @conn.assigns.current_user %>
<script>
window.fetch && window.location.hostname !== 'localhost' && fetch(`https://cockpit.azimutt.app/api/events`, {
Expand Down

0 comments on commit 1e4a806

Please sign in to comment.