<%= if !Application.get_env(:plausible, :is_selfhost) do %>

Subscription Plan

<%= if @subscription do %> <%= present_subscription_status(@subscription.status) %> <% end %>
<%= if @subscription && @subscription.status == "deleted" do %>

<%= if @subscription.next_bill_date && Timex.compare(@subscription.next_bill_date, Timex.today()) >= 0 do %> Your subscription is cancelled but you have access to your stats until <%= Timex.format!(@subscription.next_bill_date, "{Mshort} {D}, {YYYY}") %>. Upgrade below to make sure you don't lose access. <% else %> Your subscription is cancelled. Upgrade below to get access to your stats again. <% end %>

<% end %>

Monthly quota

<%= if @subscription do %>
<%= subscription_quota(@subscription) %> pageviews
<%= case @subscription.status do %> <% "active" -> %> <%= link("Change plan", to: "/billing/change-plan", class: "text-sm text-indigo-500 font-medium") %> <% "past_due" -> %> Change plan <% _ -> %> <% end %> <% else %>
Free trial
<%= link("Upgrade", to: "/billing/upgrade", class: "text-sm text-indigo-500 font-medium") %> <% end %>

Next bill amount

<%= if @subscription && @subscription.status in ["active", "past_due"] do %>
<%= PlausibleWeb.BillingView.present_currency(@subscription.currency_code) %><%= @subscription.next_bill_amount %>
<%= if @subscription.update_url do %> <%= link("Update billing info", to: @subscription.update_url, class: "text-sm text-indigo-500 font-medium") %> <% end %> <% else %>
---
<% end %>

Next bill date

<%= if @subscription && @subscription.next_bill_date && @subscription.status in ["active", "past_due"] do %>
<%= Timex.format!(@subscription.next_bill_date, "{Mshort} {D}, {YYYY}") %>
(<%= subscription_interval(@subscription) %> billing)
<% else %>
---
<% end %>

Your usage

Last 30 days total usage across all of your sites

Pageviews <%= delimit_integer(@usage_pageviews) %>
Custom events <%= delimit_integer(@usage_custom_events) %>
Total billable pageviews <%= delimit_integer(@usage_pageviews + @usage_custom_events) %>
<%= cond do %> <% @subscription && @subscription.status in ["active", "past_due", "paused"] && @subscription.cancel_url -> %>
<%= link("Cancel my subscription", to: @subscription.cancel_url, class: "inline-block mt-4 px-4 py-2 border border-gray-300 dark:border-gray-500 text-sm leading-5 font-medium rounded-md text-red-700 bg-white dark:bg-gray-800 hover:text-red-500 focus:outline-none focus:border-blue-300 focus:ring active:text-red-800 active:bg-gray-50 transition ease-in-out duration-150") %>
<% true -> %>
<%= link("Upgrade", to: "/billing/upgrade", class: "inline-block px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:border-indigo-700 focus:ring active:bg-indigo-700 transition ease-in-out duration-150") %>
<% end %>
<% end %>

Dashboard Appearance

<%= form_for @changeset, "/settings", [class: "max-w-sm"], fn f -> %>
<%= label f, :theme, "Theme Selection", class: "block text-sm font-medium leading-5 text-gray-700 dark:text-gray-300" %> <%= select f, :theme, Plausible.Themes.options(), class: "dark:bg-gray-900 mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 dark:border-gray-500 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md dark:text-gray-100 cursor-pointer" %>
<%= submit "Save", class: "button mt-4" %> <% end %>

Account settings

<%= form_for @changeset, "/settings", [class: "max-w-sm"], fn f -> %>
<%= label f, :name, class: "block text-sm font-medium text-gray-700 dark:text-gray-300" %>
<%= text_input f, :name, class: "shadow-sm dark:bg-gray-900 dark:text-gray-300 focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 dark:border-gray-500 rounded-md dark:bg-gray-800" %> <%= error_tag f, :name %>
<%= label f, :email, class: "block text-sm font-medium text-gray-700 dark:text-gray-300" %>
<%= email_input f, :email, class: "shadow-sm dark:bg-gray-900 dark:text-gray-300 focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 dark:border-gray-500 rounded-md" %> <%= error_tag f, :email %>
<%= submit "Save changes", class: "button mt-4" %> <% end %>

API keys

<%= if Enum.any?(@user.api_keys) do %>
<%= for api_key <- @user.api_keys do %> <% end %>
Name Key Revoke
<%= api_key.name %> <%= api_key.key_prefix %><%= String.duplicate("*", 32 - 6) %> <%= button("Revoke", to: "/settings/api-keys/#{api_key.id}", class: "text-red-600 hover:text-red-900", method: :delete, "data-confirm": "Are you sure you want to revoke this key? This action cannot be reversed.") %>
<% end %> <%= link "+ New API key", to: "/settings/api-keys/new", class: "button mt-4" %>

Delete account

Deleting your account removes all sites and stats you've collected

<%= if @subscription && @subscription.status == "active" do %> Delete my account

Your account cannot be deleted because you have an active subscription. If you want to delete your account, please cancel your subscription first.

<% else %> <%= link("Delete my account", to: "/me", class: "inline-block mt-4 px-4 py-2 border border-gray-300 dark:border-gray-500 text-sm leading-5 font-medium rounded-md text-red-700 bg-white dark:bg-gray-800 hover:text-red-500 dark:hover:text-red-400 focus:outline-none focus:border-blue-300 focus:ring active:text-red-800 active:bg-gray-50 transition ease-in-out duration-150", method: "delete", data: [confirm: "Deleting your account will also delete all the sites and data that you own. This action cannot be reversed. Are you sure?"]) %> <% end %>