analytics/lib/plausible_web/templates/auth/user_settings.html.eex

89 lines
4.3 KiB
Elixir
Raw Normal View History

<div class="max-w-2xl mx-auto bg-white shadow-md rounded rounded-t-none border-t-2 border-orange-200 px-8 pt-6 pb-8 mt-24">
<h2 class="text-xl font-black">Subscription Plan</h2>
2019-09-02 14:29:19 +03:00
<div class="mt-4 border-b border-gray-400"></div>
2019-09-02 14:29:19 +03:00
<div class="flex flex-col items-center sm:flex-row sm:items-start justify-between mt-8">
<div class="text-center bg-gray-100 py-4 px-2 rounded h-32 my-4" style="width: 11.75rem;">
2019-09-02 14:29:19 +03:00
<h4 class="font-black">Current plan</h4>
<%= if @subscription do %>
<div class="text-xl py-2 font-medium"><%= subscription_name(@subscription) %></div>
<%= link("Change plan", to: "/billing/change-plan", class: "text-sm text-indigo-500 font-medium") %>
2019-09-02 14:29:19 +03:00
<% else %>
<div class="text-xl py-2 font-medium">Free trial</div>
<%= link("Upgrade", to: "/billing/upgrade", class: "text-sm text-indigo-500 font-medium") %>
2019-09-02 14:29:19 +03:00
<% end %>
</div>
<div class="text-center bg-gray-100 py-4 px-2 rounded h-32 my-4" style="width: 11.75rem;">
2019-09-02 14:29:19 +03:00
<h4 class="font-black">Next bill amount</h4>
<%= if @subscription do %>
<div class="text-xl py-2 font-medium">$<%= @subscription.next_bill_amount %></div>
2019-11-18 11:13:54 +03:00
<%= if @subscription.update_url do %>
<%= link("Update billing info", to: @subscription.update_url, class: "text-sm text-indigo-500 font-medium") %>
2019-11-18 11:13:54 +03:00
<% end %>
2019-09-02 14:29:19 +03:00
<% else %>
<div class="text-xl py-2 font-medium">$0</div>
<% end %>
</div>
<div class="text-center bg-gray-100 py-4 px-2 rounded h-32 my-4" style="width: 11.75rem;">
2019-09-02 14:29:19 +03:00
<h4 class="font-black">Next bill date</h4>
2019-11-18 11:13:54 +03:00
<%= if @subscription && @subscription.next_bill_date do %>
2019-09-02 14:29:19 +03:00
<div class="text-xl py-2 font-medium"><%= Timex.format!(@subscription.next_bill_date, "{Mshort} {D}, {YYYY}") %></div>
<% else %>
<div class="text-xl py-2 font-medium"></div>
<% end %>
</div>
</div>
<h3 class="text-xl font-bold mt-8">Your usage</h3>
2019-09-02 14:29:19 +03:00
<div class="py-2">
<b><%= delimit_integer(Plausible.Billing.usage(@conn.assigns[:current_user])) %></b>
pageviews in the last 30 days
</div>
2019-11-18 11:13:54 +03:00
<%= if @subscription && @subscription.cancel_url do %>
2019-09-02 14:29:19 +03:00
<div class="mt-8">
<%= link("Cancel my subscription", to: @subscription.cancel_url, class: "text-indigo-500 text-sm") %>
2019-09-02 14:29:19 +03:00
</div>
<% end %>
</div>
<div class="max-w-2xl mx-auto bg-white shadow-md rounded rounded-t-none border-t-2 border-indigo-100 px-8 pt-6 pb-8 mt-16">
<h2 class="text-xl font-black">Account settings</h2>
2019-09-02 14:29:19 +03:00
<div class="my-4 border-b border-gray-300"></div>
2019-09-02 14:29:19 +03:00
<%= form_for @changeset, "/settings", [class: "max-w-sm"], fn f -> %>
2019-09-02 14:29:19 +03:00
<div class="my-4">
<%= label f, :name, class: "block text-gray-700 text-sm font-bold mb-2" %>
<%= text_input f, :name, class: "transition bg-gray-100 appearance-none border border-transparent rounded w-full p-2 text-gray-700 leading-normal appearance-none focus:outline-none focus:border-gray-300" %>
2019-09-02 14:29:19 +03:00
<%= error_tag f, :name %>
</div>
<div class="my-4">
<%= label f, :email, class: "block text-gray-700 text-sm font-bold mb-2" %>
<%= email_input f, :email, class: "transition bg-gray-100 appearance-none border border-transparent rounded w-full p-2 text-gray-700 leading-normal appearance-none focus:outline-none focus:border-gray-300" %>
2019-09-02 14:29:19 +03:00
<%= error_tag f, :email %>
</div>
<%= submit "Save changes", class: "button mt-4" %>
<% end %>
</div>
<div class="max-w-2xl mx-auto bg-white shadow-md rounded rounded-t-none border-t-2 border-red-600 px-8 pt-6 pb-8 mt-16 mb-24">
2019-09-02 14:29:19 +03:00
<div class="flex items-center justify-between">
<h2 class="text-xl font-black">Delete account</h2>
2019-09-02 14:29:19 +03:00
</div>
<div class="my-4 border-b border-gray-300"></div>
2019-09-02 14:29:19 +03:00
<p>Deleting your account removes all sites and stats you've collected</p>
<%= if @subscription && @subscription.status == "active" do %>
<span class="button bg-gray-300 mt-6 hover:shadow-none">Delete my account</span>
<p class="text-gray-600 text-sm mt-2">Your account cannot be deleted because you have an active subscription. If you want to delete your account, please cancel your subscription first.</p>
<% else %>
<%= link "Delete my account ", to: "/me", method: :delete, class: "button bg-red-600 mt-6", data: [confirm: "Deleting your account cannot be reversed. Are you sure?"] %>
<% end %>
2019-09-02 14:29:19 +03:00
</div>