Subscription
<% if @subscription.present? %>
<% if @next_plan.present? %>
Upgrade to the <%= @next_plan.name %>
<%= plan_cost(@next_plan) %>
<% if current_customer.card.present? %>
<%= link_to 'Upgrade', account_subscription_path(plan: @next_plan), method: :patch %>
<% else %>
<%= link_to 'Upgrade', edit_account_subscription_path(plan: @next_plan) %>
<% end %>
<% end %>
Current Plan
You're currently paying <%= plan_cost(@subscription.plan) %> on the <%= @subscription.plan.name %>.
<% if current_customer.card.present? %>
<%= link_to 'Change Payment Details', account_card_path %>
<% else %>
<%= link_to 'Add Payment Details', new_account_card_path %>
<% end %>
Plans
-
<%= Tang.free_plan_name %>
Free
<%= link_to 'Cancel Plan', account_subscription_path, method: :delete, data: { confirm: 'Are you sure you want to cancel your current plan?' } %>
<% @plans.each do |plan| %>
-
<%= plan.name %>
<%= plan_cost(plan) %>
<% if plan.order < @subscription.plan.order %>
<% if current_customer.card.present? %>
<%= link_to 'Downgrade', account_subscription_path(plan: plan), method: :patch %>
<% else %>
<%= link_to 'Downgrade', edit_account_subscription_path(plan: plan) %>
<% end %>
<% elsif plan.order > @subscription.plan.order %>
<% if current_customer.card.present? %>
<%= link_to 'Upgrade', account_subscription_path(plan: plan), method: :patch %>
<% else %>
<%= link_to 'Upgrade', edit_account_subscription_path(plan: plan) %>
<% end %>
<% else %>
<%= 'Current Plan' %>
<% end %>
<% end %>
<% else %>
<% if @next_plan.present? %>
Upgrade to the <%= @next_plan.name %>
<%= plan_cost(@next_plan) %>
<% if current_customer.card.present? %>
<%= link_to 'Upgrade', account_subscription_path(plan: @next_plan), method: :post %>
<% else %>
<%= link_to 'Upgrade', new_account_subscription_path(plan: @next_plan) %>
<% end %>
<% end %>
Current Plan
You're currently on the <%= Tang.free_plan_name %>.
<% if current_customer.card.present? %>
<%= link_to 'Change Payment Details', account_card_path %>
<% else %>
<%= link_to 'Add Payment Details', new_account_card_path %>
<% end %>
Plans
-
<%= Tang.free_plan_name %>
Free
<%= 'Current Plan' %>
<% @plans.each do |plan| %>
-
<%= plan.name %>
<%= plan_cost(plan) %>
<% if current_customer.card.present? %>
<%= link_to 'Upgrade', account_subscription_path(plan: plan), method: :post %>
<% else %>
<%= link_to 'Upgrade', new_account_subscription_path(plan: plan) %>
<% end %>
<% end %>
<% end %>