2021-01-15 11:12:00 +03:00
< % = if ! Application . get_env ( :plausible , :is_selfhost ) do % >
2021-02-05 12:23:30 +03:00
< div class = " max-w-2xl px-8 pt-6 pb-8 mx-auto mt-24 bg-white border-t-2 border-orange-200 rounded rounded-t-none shadow-md dark:bg-gray-800 dark:border-orange-200 " >
2020-07-07 16:36:06 +03:00
< div class = " flex justify-between " >
2020-12-16 12:57:28 +03:00
< h2 class = " text-xl font-black dark:text-gray-100 " > Subscription Plan < / h2 >
2020-07-07 16:36:06 +03:00
< % = if @subscription do % >
< span class = " inline-flex items-center px-2.5 py-0.5 rounded-md text-sm font-bold leading-5 <%= subscription_colors(@subscription.status) %> " >
< % = present_subscription_status ( @subscription . status ) % >
< / span >
< % end % >
< / div >
< div class = " my-4 border-b border-gray-400 " > < / div >
2019-09-02 14:29:19 +03:00
2020-07-07 16:36:06 +03:00
< % = if @subscription && @subscription . status == " deleted " do % >
2021-02-05 12:23:30 +03:00
< div class = " p-2 bg-red-100 rounded-lg sm:p-3 " >
< div class = " flex flex-wrap items-center justify-between " >
< div class = " flex items-center flex-1 w-0 " >
< svg class = " w-6 h-6 text-red-800 " viewBox = " 0 0 24 24 " stroke = " currentColor " fill = " none " xmlns = " http://www.w3.org/2000/svg " >
2020-07-07 16:36:06 +03:00
< path d = " M12 9V11M12 15H12.01M5.07183 19H18.9282C20.4678 19 21.4301 17.3333 20.6603 16L13.7321 4C12.9623 2.66667 11.0378 2.66667 10.268 4L3.33978 16C2.56998 17.3333 3.53223 19 5.07183 19Z " stroke - width = " 2 " stroke - linecap = " round " stroke - linejoin = " round " / >
< / svg >
< p class = " ml-3 font-medium text-red-800 " >
< % = 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 % >
< / p >
< / div >
< / div >
< / div >
< % end % >
2019-09-02 14:29:19 +03:00
2021-02-05 12:23:30 +03:00
< div class = " flex flex-col items-center justify-between mt-8 sm:flex-row sm:items-start " >
< div class = " h-32 px-2 py-4 my-4 text-center bg-gray-100 rounded dark:bg-gray-900 " style = " width: 11.75rem; " >
2020-12-16 12:57:28 +03:00
< h4 class = " font-black dark:text-gray-100 " > Monthly quota < / h4 >
2019-09-02 14:29:19 +03:00
< % = if @subscription do % >
2021-02-05 12:23:30 +03:00
< div class = " py-2 text-xl font-medium dark:text-gray-100 " > < % = subscription_quota ( @subscription ) % > pageviews < / div >
2020-07-07 16:36:06 +03:00
< % = case @subscription . status do % >
< % " active " -> % >
< % = link ( " Change plan " , to : " /billing/change-plan " , class : " text-sm text-indigo-500 font-medium " ) % >
< % " past_due " -> % >
2021-02-05 12:23:30 +03:00
< span class = " text-sm font-medium text-gray-600 dark:text-gray-400 " tooltip = " Please update your billing details before changing plans " > Change plan < / span >
2020-07-07 16:36:06 +03:00
< % _ -> % >
< % end % >
2019-09-02 14:29:19 +03:00
< % else % >
2021-02-05 12:23:30 +03:00
< div class = " py-2 text-xl font-medium dark:text-gray-100 " > Free trial < / div >
2020-03-06 12:11:38 +03:00
< % = link ( " Upgrade " , to : " /billing/upgrade " , class : " text-sm text-indigo-500 font-medium " ) % >
2019-09-02 14:29:19 +03:00
< % end % >
< / div >
2021-02-05 12:23:30 +03:00
< div class = " h-32 px-2 py-4 my-4 text-center bg-gray-100 rounded dark:bg-gray-900 " style = " width: 11.75rem; " >
2020-12-16 12:57:28 +03:00
< h4 class = " font-black dark:text-gray-100 " > Next bill amount < / h4 >
2020-07-07 16:36:06 +03:00
< % = if @subscription && @subscription . status in [ " active " , " past_due " ] do % >
2021-05-13 12:42:01 +03:00
< div class = " py-2 text-xl font-medium dark:text-gray-100 " > < % = PlausibleWeb.BillingView . present_currency ( @subscription . currency_code ) % > < % = @subscription . next_bill_amount % > < / div >
2019-11-18 11:13:54 +03:00
< % = if @subscription . update_url do % >
2020-03-06 12:11:38 +03:00
< % = 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 % >
2021-02-05 12:23:30 +03:00
< div class = " py-2 text-xl font-medium dark:text-gray-100 " > -- - < / div >
2019-09-02 14:29:19 +03:00
< % end % >
< / div >
2021-02-05 12:23:30 +03:00
< div class = " h-32 px-2 py-4 my-4 text-center bg-gray-100 rounded dark:bg-gray-900 " style = " width: 11.75rem; " >
2020-12-16 12:57:28 +03:00
< h4 class = " font-black dark:text-gray-100 " > Next bill date < / h4 >
2019-09-02 14:29:19 +03:00
2020-07-07 16:36:06 +03:00
< % = if @subscription && @subscription . next_bill_date && @subscription . status in [ " active " , " past_due " ] do % >
2021-02-05 12:23:30 +03:00
< div class = " py-2 text-xl font-medium dark:text-gray-100 " > < % = Timex . format! ( @subscription . next_bill_date , " {Mshort} {D}, {YYYY} " ) % > < / div >
< div class = " text-sm font-medium text-gray-600 dark:text-gray-400 " > ( < % = subscription_interval ( @subscription ) % > billing ) < / div >
2019-09-02 14:29:19 +03:00
< % else % >
2021-02-05 12:23:30 +03:00
< div class = " py-2 text-xl font-medium dark:text-gray-100 " > -- - < / div >
2019-09-02 14:29:19 +03:00
< % end % >
< / div >
< / div >
2021-02-05 12:23:30 +03:00
< h3 class = " mt-8 text-xl font-bold dark:text-gray-100 " > Your usage < / h3 >
< p class = " mt-1 text-sm text-gray-500 leading-5 dark:text-gray-200 " > Last 30 days total usage across all of your sites < / p >
2021-01-15 17:28:57 +03:00
< div class = " py-2 " >
< div class = " flex flex-col " >
< div class = " -my-2 sm:-mx-6 lg:-mx-8 " >
2021-02-05 12:23:30 +03:00
< div class = " inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8 " >
2021-01-15 17:28:57 +03:00
< div >
2021-02-05 12:23:30 +03:00
< table class = " min-w-full text-gray-900 divide-y divide-gray-200 dark:text-gray-100 " >
2021-01-15 17:28:57 +03:00
< tbody class = " bg-white dark:bg-gray-800 divide-y divide-gray-200 " >
< tr >
2021-02-05 12:23:30 +03:00
< td class = " py-4 text-sm whitespace-nowrap " >
2021-01-15 17:28:57 +03:00
Pageviews
< / td >
2021-02-05 12:23:30 +03:00
< td class = " py-4 text-sm whitespace-nowrap " >
2021-01-15 17:28:57 +03:00
< % = delimit_integer ( @usage_pageviews ) % >
< / td >
< / tr >
< tr >
2021-02-05 12:23:30 +03:00
< td class = " py-4 text-sm whitespace-nowrap " >
2021-01-15 17:28:57 +03:00
Custom events
< / td >
2021-02-05 12:23:30 +03:00
< td class = " py-4 text-sm whitespace-nowrap " >
2021-01-15 17:28:57 +03:00
< % = delimit_integer ( @usage_custom_events ) % >
< / td >
< / tr >
< tr >
2021-02-05 12:23:30 +03:00
< td class = " py-4 text-sm font-medium whitespace-nowrap " >
2021-01-15 17:28:57 +03:00
Total billable pageviews
< / td >
2021-02-05 12:23:30 +03:00
< td class = " py-4 text-sm font-medium whitespace-nowrap " >
2021-01-15 17:28:57 +03:00
< % = delimit_integer ( @usage_pageviews + @usage_custom_events ) % >
< / td >
< / tr >
2019-09-02 14:29:19 +03:00
2021-01-15 17:28:57 +03:00
< / tbody >
< / table >
< / div >
< / div >
< / div >
< / div >
2019-09-02 14:29:19 +03:00
< / div >
2020-07-07 16:36:06 +03:00
< % = cond do % >
< % @subscription && @subscription . status in [ " active " , " past_due " , " paused " ] && @subscription . cancel_url -> % >
< div class = " mt-8 " >
2020-12-16 12:57:28 +03:00
< % = 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 " ) % >
2020-07-07 16:36:06 +03:00
< / div >
< % true -> % >
< div class = " mt-8 " >
2020-11-19 15:24:08 +03:00
< % = 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 " ) % >
2020-07-07 16:36:06 +03:00
< / div >
2019-09-02 14:29:19 +03:00
< % end % >
< / div >
2021-12-09 16:49:57 +03:00
< % = case @invoices do % >
< % { :error , :no_subscription } -> % >
< % { :error , :request_failed } -> % >
< div class = " max-w-2xl px-8 pt-6 pb-8 mx-auto mt-16 bg-white border-t-2 border-orange-200 rounded rounded-t-none shadow-md dark:bg-gray-800 " >
< h2 class = " text-xl font-black dark:text-gray-100 " > Invoices < / h2 >
< div class = " my-4 border-b border-gray-300 dark:border-gray-500 " > < / div >
< p class = " text-center text-black dark:text-gray-100 m-2 " >
Something went wrong
< / p >
< / div >
< % invoice_list -> % >
< div class = " max-w-2xl px-8 pt-6 pb-8 mx-auto mt-16 bg-white border-t-2 border-orange-200 rounded rounded-t-none shadow-md dark:bg-gray-800 " >
< h2 class = " text-xl font-black dark:text-gray-100 " > Invoices < / h2 >
< div class = " my-4 border-b border-gray-300 dark:border-gray-500 " > < / div >
< table class = " min-w-full divide-y divide-gray-200 " >
< thead >
< tr >
< th scope = " col " class = " py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider " >
Date
< / th >
< th scope = " col " class = " py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider " >
Amount
< / th >
< th scope = " col " class = " py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider " >
Invoice
< / th >
< / tr >
< / thead >
< % = for invoice <- format_invoices ( invoice_list ) do % >
< tbody class = " divide-y divide-gray-200 " >
< tr >
< td class = " py-4 text-sm text-gray-800 dark:text-gray-200 font-medium " >
< % = invoice . date % >
< / td >
< td class = " py-4 text-sm text-gray-800 dark:text-gray-200 " >
< % = invoice . currency <> invoice . amount % >
< / td >
< td class = " py-4 text-sm text-indigo-500 " >
< % = link ( " Link " , to : invoice . url , target : " _blank " ) % >
< / td >
< / tr >
< / tbody >
< % end % >
< / table >
< / div >
< % end % >
2020-07-21 09:58:00 +03:00
< % end % >
2019-09-02 14:29:19 +03:00
2021-02-05 12:23:30 +03:00
< div class = " max-w-2xl px-8 pt-6 pb-8 mx-auto mt-16 bg-white border-t-2 border-green-500 rounded rounded-t-none shadow-md dark:bg-gray-800 " >
2020-12-16 12:57:28 +03:00
< h2 class = " text-xl font-black dark:text-gray-100 " > Dashboard Appearance < / h2 >
2019-09-02 14:29:19 +03:00
2020-12-16 12:57:28 +03:00
< div class = " my-4 border-b border-gray-300 dark:border-gray-500 " > < / div >
< % = form_for @changeset , " /settings " , [ class : " max-w-sm " ] , fn f -> % >
< div class = " col-span-4 sm:col-span-2 " >
< % = 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 " % >
< / div >
< % = submit " Save " , class : " button mt-4 " % >
< % end % >
< / div >
2021-02-05 12:23:30 +03:00
< div class = " max-w-2xl px-8 pt-6 pb-8 mx-auto mt-16 bg-white border-t-2 border-indigo-100 rounded rounded-t-none shadow-md dark:bg-gray-800 dark:border-indigo-500 " >
2020-12-16 12:57:28 +03:00
< h2 class = " text-xl font-black dark:text-gray-100 " > Account settings < / h2 >
< div class = " my-4 border-b border-gray-300 dark:border-gray-500 " > < / div >
2019-09-02 14:29:19 +03:00
2020-03-06 12:11:38 +03:00
< % = form_for @changeset , " /settings " , [ class : " max-w-sm " ] , fn f -> % >
2019-09-02 14:29:19 +03:00
< div class = " my-4 " >
2020-12-16 12:57:28 +03:00
< % = label f , :name , class : " block text-sm font-medium text-gray-700 dark:text-gray-300 " % >
2020-12-15 12:30:45 +03:00
< div class = " mt-1 " >
2020-12-16 12:57:28 +03:00
< % = 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 " % >
2020-12-15 12:30:45 +03:00
< % = error_tag f , :name % >
< / div >
2019-09-02 14:29:19 +03:00
< / div >
< div class = " my-4 " >
2020-12-16 12:57:28 +03:00
< % = label f , :email , class : " block text-sm font-medium text-gray-700 dark:text-gray-300 " % >
2020-12-15 12:30:45 +03:00
< div class = " mt-1 " >
2020-12-16 12:57:28 +03:00
< % = 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 " % >
2020-12-15 12:30:45 +03:00
< % = error_tag f , :email % >
< / div >
2019-09-02 14:29:19 +03:00
< / div >
< % = submit " Save changes " , class : " button mt-4 " % >
< % end % >
< / div >
2021-02-05 12:23:30 +03:00
< div id = " api-keys " class = " max-w-2xl px-8 pt-6 pb-8 mx-auto mt-16 bg-white border-t-2 border-indigo-100 rounded rounded-t-none shadow-md dark:bg-gray-800 dark:border-indigo-500 " >
< h2 class = " text-xl font-black dark:text-gray-100 " > API keys < / h2 >
< div class = " my-4 border-b border-gray-300 dark:border-gray-500 " > < / div >
2021-02-05 12:48:20 +03:00
< div class = " flex flex-col mt-6 " >
2021-02-05 12:23:30 +03:00
< div class = " -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8 " >
< div class = " inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8 " >
< % = if Enum . any? ( @user . api_keys ) do % >
2021-02-05 12:48:20 +03:00
< div class = " overflow-hidden border-b border-gray-200 shadow dark:border-gray-900 sm:rounded-lg " >
< table class = " min-w-full divide-y divide-gray-200 dark:divide-gray-900 " >
< thead class = " bg-gray-50 dark:bg-gray-900 " >
2021-02-05 12:23:30 +03:00
< tr >
2021-02-05 12:48:20 +03:00
< th scope = " col " class = " px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase dark:text-gray-100 " >
2021-02-05 12:23:30 +03:00
Name
< / th >
2021-02-05 12:48:20 +03:00
< th scope = " col " class = " px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase dark:text-gray-100 " >
2021-02-05 12:23:30 +03:00
Key
< / th >
< th scope = " col " class = " relative px-6 py-3 " >
2021-02-05 12:48:20 +03:00
< span class = " sr-only " > Revoke < / span >
2021-02-05 12:23:30 +03:00
< / th >
< / tr >
< / thead >
< tbody >
< % = for api_key <- @user . api_keys do % >
2021-02-05 12:48:20 +03:00
< tr class = " bg-white dark:bg-gray-800 " >
< td class = " px-6 py-4 text-sm font-medium text-gray-900 dark:text-gray-100 whitespace-nowrap " >
2021-02-05 12:23:30 +03:00
< % = api_key . name % >
< / td >
2021-02-05 12:48:20 +03:00
< td class = " px-6 py-4 text-sm text-gray-500 dark:text-gray-100 whitespace-nowrap " >
2021-02-05 12:23:30 +03:00
< % = api_key . key_prefix % > < % = String . duplicate ( " * " , 32 - 6 ) % >
< / td >
< td class = " px-6 py-4 text-sm font-medium text-right whitespace-nowrap " >
< % = 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. " ) % >
< / td >
< / tr >
< % end % >
< / tbody >
< / table >
< / div >
< % end % >
< % = link " + New API key " , to : " /settings/api-keys/new " , class : " button mt-4 " % >
< / div >
< / div >
< / div >
< / div >
< div class = " max-w-2xl px-8 pt-6 pb-8 mx-auto mt-16 mb-24 bg-white border-t-2 border-red-600 rounded rounded-t-none shadow-md dark:bg-gray-800 " >
2019-09-02 14:29:19 +03:00
< div class = " flex items-center justify-between " >
2020-12-16 12:57:28 +03:00
< h2 class = " text-xl font-black dark:text-gray-100 " > Delete account < / h2 >
2019-09-02 14:29:19 +03:00
< / div >
2020-12-16 12:57:28 +03:00
< div class = " my-4 border-b border-gray-300 dark:border-gray-500 " > < / div >
2019-09-02 14:29:19 +03:00
2020-12-16 12:57:28 +03:00
< p class = " dark:text-gray-100 " > Deleting your account removes all sites and stats you ' ve collected</p>
2020-01-29 17:00:18 +03:00
< % = if @subscription && @subscription . status == " active " do % >
2021-11-26 16:39:42 +03:00
< span class = " mt-6 bg-gray-300 button dark:bg-gray-800 hover:shadow-none hover:bg-gray-300 " > Delete my account < / span >
2021-02-05 12:23:30 +03:00
< p class = " mt-2 text-sm text-gray-600 dark:text-gray-400 " > Your account cannot be deleted because you have an active subscription . If you want to delete your account , please cancel your subscription first . < / p >
2020-01-29 17:00:18 +03:00
< % else % >
2021-11-26 16:39:42 +03:00
< % = 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? " ] ) % >
2020-01-29 17:00:18 +03:00
< % end % >
2019-09-02 14:29:19 +03:00
< / div >