summaryrefslogtreecommitdiff
path: root/billing/app/views/subscriptions
diff options
context:
space:
mode:
Diffstat (limited to 'billing/app/views/subscriptions')
-rw-r--r--billing/app/views/subscriptions/_subscription_details.html.haml19
-rw-r--r--billing/app/views/subscriptions/create.html.haml9
-rw-r--r--billing/app/views/subscriptions/destroy.html.haml7
-rw-r--r--billing/app/views/subscriptions/index.html.haml7
-rw-r--r--billing/app/views/subscriptions/new.html.haml15
-rw-r--r--billing/app/views/subscriptions/show.html.haml6
6 files changed, 63 insertions, 0 deletions
diff --git a/billing/app/views/subscriptions/_subscription_details.html.haml b/billing/app/views/subscriptions/_subscription_details.html.haml
new file mode 100644
index 0000000..fb18210
--- /dev/null
+++ b/billing/app/views/subscriptions/_subscription_details.html.haml
@@ -0,0 +1,19 @@
+%p
+ = link_to subscription.id, subscription_path(subscription.id)
+ Balance:
+ = number_to_currency(subscription.balance)
+ Bill on:
+ = subscription.billing_day_of_month
+ Start date:
+ = subscription.first_billing_date
+ Paid through:
+ = subscription.paid_through_date
+ Plan:
+ = subscription.plan_id
+ Price:
+ = subscription.price
+ - color = (subscription.status == 'Active') ? "green" : "red"
+ Status:
+ %font{:color => color}
+ = subscription.status
+ - # would be good to get plan name but not sure if that is possible? \ No newline at end of file
diff --git a/billing/app/views/subscriptions/create.html.haml b/billing/app/views/subscriptions/create.html.haml
new file mode 100644
index 0000000..2b6c5e9
--- /dev/null
+++ b/billing/app/views/subscriptions/create.html.haml
@@ -0,0 +1,9 @@
+- if @result.success?
+ %h1
+ Subscription Status
+ = @result.subscription.status
+ = render :partial => "subscription_details", :locals => {:subscription => @result.subscription}
+- else
+ %h1
+ Error:
+ = @result.message \ No newline at end of file
diff --git a/billing/app/views/subscriptions/destroy.html.haml b/billing/app/views/subscriptions/destroy.html.haml
new file mode 100644
index 0000000..e7ed6e8
--- /dev/null
+++ b/billing/app/views/subscriptions/destroy.html.haml
@@ -0,0 +1,7 @@
+- if @result.success?
+ Subscription destroyed
+- else
+ Error:
+ = @result.message
+%p
+ = link_to 'Customer Information', show_customer_path(@customer.braintree_customer_id), :class=> :btn \ No newline at end of file
diff --git a/billing/app/views/subscriptions/index.html.haml b/billing/app/views/subscriptions/index.html.haml
new file mode 100644
index 0000000..0e84619
--- /dev/null
+++ b/billing/app/views/subscriptions/index.html.haml
@@ -0,0 +1,7 @@
+- active = false
+- @subscriptions.each do |s|
+ - if s.status == 'Active'
+ - active = true
+ = render :partial => "subscription_details", :locals => {:subscription => s}
+- if !active
+ = link_to 'subscribe to plan', new_subscription_path, :class => :btn \ No newline at end of file
diff --git a/billing/app/views/subscriptions/new.html.haml b/billing/app/views/subscriptions/new.html.haml
new file mode 100644
index 0000000..4183458
--- /dev/null
+++ b/billing/app/views/subscriptions/new.html.haml
@@ -0,0 +1,15 @@
+- if @payment_method_token
+ %h1
+ Subscribe to plan
+ = #currently just one plan
+ = @plans[0].name
+ = number_to_currency(@plans[0].price)
+ = simple_form_for :subscription, :url => :subscriptions do |f|
+ = hidden_field_tag :payment_method_token, @payment_method_token
+ = hidden_field_tag :plan_id, @plans[0].id
+ .form-actions
+ = f.submit t(:subscribe), :class => 'btn btn-primary'
+- else
+ = t(:must_create_customer)
+ %p
+ = link_to t(:create_new_customer), new_customer_path
diff --git a/billing/app/views/subscriptions/show.html.haml b/billing/app/views/subscriptions/show.html.haml
new file mode 100644
index 0000000..10eb667
--- /dev/null
+++ b/billing/app/views/subscriptions/show.html.haml
@@ -0,0 +1,6 @@
+%h1
+ - if @subscription.status == 'Active'
+ Current
+ Subscription
+= render :partial => "subscription_details", :locals => {:subscription => @subscription}
+= link_to t(:cancel_subscription), subscription_path, :confirm => t(:are_you_sure), :method => :delete, :class => 'btn btn-danger' if @subscription.status == 'Active' # permission check or should that just be on show?