From 636692f9921bd695d726695d2d46c91f5a6e56f3 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 11 Apr 2014 10:03:19 +0200 Subject: move engines into engines directory Also renamed help to support so it's harder to confuse it with documentation --- .../billing/app/views/billing_admin/show.html.haml | 7 ++++++ .../app/views/credit_card_info/confirm.html.haml | 5 ++++ .../app/views/credit_card_info/edit.html.haml | 17 ++++++++++++++ .../app/views/customer/_customer_data.html.haml | 16 +++++++++++++ .../app/views/customer/_transaction.html.haml | 0 .../billing/app/views/customer/confirm.html.haml | 14 +++++++++++ engines/billing/app/views/customer/edit.html.haml | 23 ++++++++++++++++++ engines/billing/app/views/customer/new.html.haml | 24 +++++++++++++++++++ engines/billing/app/views/customer/show.html.haml | 27 ++++++++++++++++++++++ .../views/payments/_non_customer_fields.html.haml | 16 +++++++++++++ .../views/payments/_transaction_details.html.haml | 15 ++++++++++++ .../billing/app/views/payments/confirm.html.haml | 26 +++++++++++++++++++++ engines/billing/app/views/payments/index.html.haml | 5 ++++ engines/billing/app/views/payments/new.html.haml | 17 ++++++++++++++ .../subscriptions/_subscription_details.html.haml | 26 +++++++++++++++++++++ .../app/views/subscriptions/create.html.haml | 9 ++++++++ .../app/views/subscriptions/destroy.html.haml | 7 ++++++ .../app/views/subscriptions/index.html.haml | 8 +++++++ .../billing/app/views/subscriptions/new.html.haml | 15 ++++++++++++ .../billing/app/views/subscriptions/show.html.haml | 6 +++++ 20 files changed, 283 insertions(+) create mode 100644 engines/billing/app/views/billing_admin/show.html.haml create mode 100644 engines/billing/app/views/credit_card_info/confirm.html.haml create mode 100644 engines/billing/app/views/credit_card_info/edit.html.haml create mode 100644 engines/billing/app/views/customer/_customer_data.html.haml create mode 100644 engines/billing/app/views/customer/_transaction.html.haml create mode 100644 engines/billing/app/views/customer/confirm.html.haml create mode 100644 engines/billing/app/views/customer/edit.html.haml create mode 100644 engines/billing/app/views/customer/new.html.haml create mode 100644 engines/billing/app/views/customer/show.html.haml create mode 100644 engines/billing/app/views/payments/_non_customer_fields.html.haml create mode 100644 engines/billing/app/views/payments/_transaction_details.html.haml create mode 100644 engines/billing/app/views/payments/confirm.html.haml create mode 100644 engines/billing/app/views/payments/index.html.haml create mode 100644 engines/billing/app/views/payments/new.html.haml create mode 100644 engines/billing/app/views/subscriptions/_subscription_details.html.haml create mode 100644 engines/billing/app/views/subscriptions/create.html.haml create mode 100644 engines/billing/app/views/subscriptions/destroy.html.haml create mode 100644 engines/billing/app/views/subscriptions/index.html.haml create mode 100644 engines/billing/app/views/subscriptions/new.html.haml create mode 100644 engines/billing/app/views/subscriptions/show.html.haml (limited to 'engines/billing/app/views') diff --git a/engines/billing/app/views/billing_admin/show.html.haml b/engines/billing/app/views/billing_admin/show.html.haml new file mode 100644 index 0000000..0382cf0 --- /dev/null +++ b/engines/billing/app/views/billing_admin/show.html.haml @@ -0,0 +1,7 @@ +%legend= t(:more_than_90_days_past_due) += render(:partial => "subscriptions/subscription_details", :collection => @past_due_atleast_90_days, :as => 'subscription', :locals => {:show_user => true}) || t(:none) +%legend= t(:all_past_due) += render(:partial => "subscriptions/subscription_details", :collection => @all_past_due, :as => 'subscription', :locals => {:show_user => true}) || t(:none) + +%legend= t(:your_settings) += link_to 'view own billing settings', show_or_new_customer_link(current_user) \ No newline at end of file diff --git a/engines/billing/app/views/credit_card_info/confirm.html.haml b/engines/billing/app/views/credit_card_info/confirm.html.haml new file mode 100644 index 0000000..9dd8176 --- /dev/null +++ b/engines/billing/app/views/credit_card_info/confirm.html.haml @@ -0,0 +1,5 @@ +%h1 Payment Info Confirmation +%p Your payment information was successfully saved. +%dl + %dt Credit Card + %dd= @result.credit_card.masked_number diff --git a/engines/billing/app/views/credit_card_info/edit.html.haml b/engines/billing/app/views/credit_card_info/edit.html.haml new file mode 100644 index 0000000..bd86a4c --- /dev/null +++ b/engines/billing/app/views/credit_card_info/edit.html.haml @@ -0,0 +1,17 @@ +%h1 Change Credit Card +- if @result + #total-errors{:style => "color:red;"} + = h(@result.errors.size) + error(s) += braintree_form_for :credit_card, :existing => @credit_card do |f| + = field_set_tag "Credit Card" do + %dl + %dt= f.label :number, 'Number' + %dd= f.text_field :number + %dt= f.label :expiration_date, 'Expiration Date (MM/YY)' + %dd= f.text_field :expiration_date + %dt= f.label :cvv, 'CVV' + %dd= f.text_field :cvv + = hidden_field_tag :tr_data, @tr_data + = f.submit 'Save Payment Info', :class => :btn + = link_to t(:cancel), edit_customer_path(@user.id), :class => :btn diff --git a/engines/billing/app/views/customer/_customer_data.html.haml b/engines/billing/app/views/customer/_customer_data.html.haml new file mode 100644 index 0000000..e9df040 --- /dev/null +++ b/engines/billing/app/views/customer/_customer_data.html.haml @@ -0,0 +1,16 @@ +%legend= t(:customer_information) +%dl + %dt First Name + %dd= @customer.first_name + %dt Last Name + %dd= @customer.last_name + %dt Phone + %dd= @customer.phone +%legend= t(:credit_card_information) +%dl + %dt Number + %dd= @default_cc.masked_number + %dt Expiration Date + %dd= @default_cc.expiration_date + - if current_user == @user + = link_to t(:edit_saved_data), edit_customer_path(@user.id), :class => :btn diff --git a/engines/billing/app/views/customer/_transaction.html.haml b/engines/billing/app/views/customer/_transaction.html.haml new file mode 100644 index 0000000..e69de29 diff --git a/engines/billing/app/views/customer/confirm.html.haml b/engines/billing/app/views/customer/confirm.html.haml new file mode 100644 index 0000000..877a8ac --- /dev/null +++ b/engines/billing/app/views/customer/confirm.html.haml @@ -0,0 +1,14 @@ +%h1 Payment Info Confirmation +%p Your payment information was successfully saved. +%dl + %dt First Name + %dd= @result.customer.first_name + %dt Last Name + %dd= @result.customer.last_name + %dt Phone + %dd= @result.customer.phone + %dt Credit Card + - @result.customer.credit_cards.each do |cc| + %dd= cc.masked_number +- customer = Customer.find_by_user_id(@user.id) += link_to 'View Customer Info', show_customer_path(@user.id), :class=> :btn \ No newline at end of file diff --git a/engines/billing/app/views/customer/edit.html.haml b/engines/billing/app/views/customer/edit.html.haml new file mode 100644 index 0000000..e882d53 --- /dev/null +++ b/engines/billing/app/views/customer/edit.html.haml @@ -0,0 +1,23 @@ +- if @result + #total-errors{:style => "color:red;"} + = h(@result.errors.size) + error(s) += braintree_form_for :customer, existing: @customer do |f| + = field_set_tag "Customer" do + %dl + %dt= f.label :first_name, 'First Name' + %dd= f.text_field :first_name + %dt= f.label :last_name, 'Last Name' + %dd= f.text_field :last_name + %dt= f.label :phone, 'Phone' + %dd= f.text_field :phone + - if @default_cc + = # todo, as they will need a credit card, so not sure about conditional? + %dt= t(:stored_credit_card) + %dd + = @default_cc.masked_number + = link_to t(:change_credit_card), edit_credit_card_info_path(:id => @default_cc.token), :class => :btn + = hidden_field_tag :tr_data, @tr_data + .form-actions + = f.submit t(:save_customer_info), :class => 'btn btn-primary' + = link_to t(:cancel), show_customer_path(@user), :class=> :btn diff --git a/engines/billing/app/views/customer/new.html.haml b/engines/billing/app/views/customer/new.html.haml new file mode 100644 index 0000000..e1f5ba9 --- /dev/null +++ b/engines/billing/app/views/customer/new.html.haml @@ -0,0 +1,24 @@ +- if @result + #total-errors{:style => "color:red;"} + = h(@result.errors.size) + error(s) += braintree_form_for :customer do |f| + = field_set_tag "Customer" do + %dl + %dt= f.label :first_name, 'First Name' + %dd= f.text_field :first_name + %dt= f.label :last_name, 'Last Name' + %dd= f.text_field :last_name + %dt= f.label :phone, 'Phone' + %dd= f.text_field :phone + = field_set_tag "Credit Card" do + - f.fields_for :credit_card do |cc| + %dl + %dt= cc.label :number, 'Number' + %dd= cc.text_field :number + %dt= cc.label :expiration_date, 'Expiration Date (MM/YY)' + %dd= cc.text_field :expiration_date + %dt= cc.label :cvv, 'CVV' + %dd= cc.text_field :cvv + = hidden_field_tag :tr_data, @tr_data + = f.submit 'Save Payment Info' diff --git a/engines/billing/app/views/customer/show.html.haml b/engines/billing/app/views/customer/show.html.haml new file mode 100644 index 0000000..ec1779c --- /dev/null +++ b/engines/billing/app/views/customer/show.html.haml @@ -0,0 +1,27 @@ +- if admin? and !@customer + = t(:no_saved_customer) +- else + = render :partial => 'customer_data' + %legend= t(:last_three_transactions) + - counter = 0 + = # these will be ordered with most recently created first, per http://stackoverflow.com/questions/16425475/ + - @transactions.each do |t| + - break if counter > 2 # not ruby-like, but object is a Braintree::ResourceCollection so limited methods available + = render :partial => "payments/transaction_details", :locals => {:transaction => t} + - counter += 1 + = link_to t(:transaction_history), user_payments_path(@user) + %legend= t(:subscriptions) + - if @active_subscription + = render :partial => "subscriptions/subscription_details", :locals => {:subscription => @active_subscription} + - else + %p + = t(:no_relevant_subscription) + - if current_user == @user + %p + .form-actions + = link_to t(:subscribe_to_plan), new_subscription_path, :class => :btn + %p + = link_to t(:all_subscriptions), user_subscriptions_path(@user) + +.form-actions + = link_to t(:make_donation), new_payment_path, :class => 'btn btn-primary' diff --git a/engines/billing/app/views/payments/_non_customer_fields.html.haml b/engines/billing/app/views/payments/_non_customer_fields.html.haml new file mode 100644 index 0000000..77cfe95 --- /dev/null +++ b/engines/billing/app/views/payments/_non_customer_fields.html.haml @@ -0,0 +1,16 @@ += field_set_tag "Personal Information" do + = f.fields_for :customer do |c| + %div= c.label :first_name, "First Name" + %div= c.text_field :first_name + %div= c.label :last_name, "Last Name" + %div= c.text_field :last_name + %div= c.label :email, "Email" + %div= c.text_field :email += field_set_tag "Credit Card" do + = f.fields_for :credit_card do |c| + %div= c.label :number, "Number" + %div= c.text_field :number + %div= c.label :expiration_date, "Expiration Date (MM/YY)" + %div= c.text_field :expiration_date + %div= c.label :cvv, "CVV" + %div= c.text_field :cvv \ No newline at end of file diff --git a/engines/billing/app/views/payments/_transaction_details.html.haml b/engines/billing/app/views/payments/_transaction_details.html.haml new file mode 100644 index 0000000..85e4f6a --- /dev/null +++ b/engines/billing/app/views/payments/_transaction_details.html.haml @@ -0,0 +1,15 @@ +%p + = transaction.id + Type: + = transaction.type + Amount: + = number_to_currency(transaction.amount) + Status: + = transaction.status + Date + = transaction.created_at.strftime("%Y-%m-%d") + - if sub_start = transaction.subscription_details.billing_period_start_date + From subscription which started + = sub_start + - else # should not have any of these + Not paid as part of subscription \ No newline at end of file diff --git a/engines/billing/app/views/payments/confirm.html.haml b/engines/billing/app/views/payments/confirm.html.haml new file mode 100644 index 0000000..45af3c9 --- /dev/null +++ b/engines/billing/app/views/payments/confirm.html.haml @@ -0,0 +1,26 @@ +%h1 Payment Result +%div Thank you for your donation. +%h2 Transaction Details +%table + %tr + %td Amount + %td + $#{@result.transaction.amount} + %tr + %td Transaction ID: + %td= @result.transaction.id + %tr + %td First Name: + %td= h @result.transaction.customer_details.first_name + %tr + %td Last Name: + %td= h @result.transaction.customer_details.last_name + %tr + %td Email: + %td= h @result.transaction.customer_details.email + %tr + %td Credit Card: + %td= h @result.transaction.credit_card_details.masked_number + %tr + %td Card Type: + %td= h @result.transaction.credit_card_details.card_type \ No newline at end of file diff --git a/engines/billing/app/views/payments/index.html.haml b/engines/billing/app/views/payments/index.html.haml new file mode 100644 index 0000000..7a89917 --- /dev/null +++ b/engines/billing/app/views/payments/index.html.haml @@ -0,0 +1,5 @@ +%h2=t :transaction_history +- if (@transactions.count == 0) + = t(:no_transaction_history) +- @transactions.each do |t| + = render :partial => "transaction_details", :locals => {:transaction => t} \ No newline at end of file diff --git a/engines/billing/app/views/payments/new.html.haml b/engines/billing/app/views/payments/new.html.haml new file mode 100644 index 0000000..e9a8273 --- /dev/null +++ b/engines/billing/app/views/payments/new.html.haml @@ -0,0 +1,17 @@ +%h1 + = t(:Donation) +- if logged_in? + = t(:donation_not_payment) +- if @result and @result.errors.size > 0 + %div{:style => "color: red;"} + = h @result.errors.size + error(s) +- if @result and @result.transaction and @result.transaction.status != 'success' + %div{:style => "color: red;"} + = t(:processor_declined) += braintree_form_for :transaction, :html => {:autocomplete => "off"} do |f| + = f.label :amount, t(:amount) + = f.text_field :amount + = render :partial => 'non_customer_fields', :locals => {:f => f} + = hidden_field_tag :tr_data, @tr_data + = f.submit "Submit Donation", :class => 'btn btn-primary' diff --git a/engines/billing/app/views/subscriptions/_subscription_details.html.haml b/engines/billing/app/views/subscriptions/_subscription_details.html.haml new file mode 100644 index 0000000..6145c95 --- /dev/null +++ b/engines/billing/app/views/subscriptions/_subscription_details.html.haml @@ -0,0 +1,26 @@ +%p + - if local_assigns[:show_user] + User: + - user_to_show = user_for_subscription(subscription) + = link_to user_to_show.login, user_overview_path(user_to_show) + ID: + = link_to subscription.id, user_subscription_path(@user, subscription.id) + Balance: + - color = (subscription.balance > 0) ? "red" : "" + %font{:color => color} + = 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: + = number_to_currency(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/engines/billing/app/views/subscriptions/create.html.haml b/engines/billing/app/views/subscriptions/create.html.haml new file mode 100644 index 0000000..2b6c5e9 --- /dev/null +++ b/engines/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/engines/billing/app/views/subscriptions/destroy.html.haml b/engines/billing/app/views/subscriptions/destroy.html.haml new file mode 100644 index 0000000..44b4333 --- /dev/null +++ b/engines/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(@user), :class=> :btn \ No newline at end of file diff --git a/engines/billing/app/views/subscriptions/index.html.haml b/engines/billing/app/views/subscriptions/index.html.haml new file mode 100644 index 0000000..3d4e8fd --- /dev/null +++ b/engines/billing/app/views/subscriptions/index.html.haml @@ -0,0 +1,8 @@ +%h2=t :all_subscriptions +- pending_active_pastdue = false +- @subscriptions.each do |s| + - if ['Pending', 'Active','Past Due'].include? s.status + - pending_active_pastdue = true + = render :partial => "subscription_details", :locals => {:subscription => s} +- if !pending_active_pastdue and @user == current_user + = link_to 'subscribe to plan', new_subscription_path, :class => :btn \ No newline at end of file diff --git a/engines/billing/app/views/subscriptions/new.html.haml b/engines/billing/app/views/subscriptions/new.html.haml new file mode 100644 index 0000000..4183458 --- /dev/null +++ b/engines/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/engines/billing/app/views/subscriptions/show.html.haml b/engines/billing/app/views/subscriptions/show.html.haml new file mode 100644 index 0000000..2699db9 --- /dev/null +++ b/engines/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), user_subscription_path(@user, @subscription.id), :confirm => t(:are_you_sure), :method => :delete, :class => 'btn btn-danger' if allow_cancel_subscription(@subscription) -- cgit v1.2.3