dashboard.jade 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. extends ../layout
  2. block scripts
  3. script(src="https://js.recurly.com/v3/recurly.js")
  4. script(type='text/javascript').
  5. window.recomendedCurrency = '#{recomendedCurrency}'
  6. window.recurlyApiKey = "!{settings.apis.recurly.publicKey}"
  7. window.taxRate = #{taxRate}
  8. window.subscription = !{JSON.stringify(subscription)}
  9. mixin printPlan(plan)
  10. -if (!plan.hideFromUsers)
  11. tr(ng-controller="ChangePlanFormController")
  12. td(ng-init="plan=#{JSON.stringify(plan)}")
  13. strong #{plan.name}
  14. td {{refreshPrice(plan.planCode)}}
  15. -if (plan.annual)
  16. | {{prices[plan.planCode]}} / #{translate("year")}
  17. -else
  18. | {{prices[plan.planCode]}} / #{translate("month")}
  19. td
  20. -if (subscription.state == "free-trial")
  21. a(href="/user/subscription/new?planCode=#{plan.planCode}").btn.btn-success #{translate("subscribe_to_this_plan")}
  22. -else if (typeof(subscription.planCode) != "undefined" && plan.planCode == subscription.planCode.split("_")[0])
  23. button.btn.disabled #{translate("your_plan")}
  24. -else
  25. form
  26. input(type="hidden", ng-model="plan_code", name="plan_code", value="#{plan.planCode}")
  27. input(type="submit", ng-click="changePlan()", value=translate("change_to_this_plan")).btn.btn-success
  28. mixin printPlans(plans)
  29. -each plan in plans
  30. mixin printPlan(plan)
  31. block content
  32. .content.content-alt(ng-cloak)
  33. .container(ng-controller="UserSubscriptionController")
  34. .row
  35. .col-md-8.col-md-offset-2
  36. .card(ng-if="view == 'overview'")
  37. .page-header
  38. h1 #{translate("your_subscription")}
  39. - if (subscription && user._id+'' == subscription.admin_id+'')
  40. case subscription.state
  41. when "free-trial"
  42. p !{translate("on_free_trial_expiring_at", {expiresAt:"<strong>" + subscription.expiresAt + "</strong>"})}
  43. when "active"
  44. p !{translate("currently_subscribed_to_plan", {planName:"<strong>" + subscription.name + "</strong>"})}
  45. a(href, ng-click="changePlan = true") !{translate("change_plan")}.
  46. p !{translate("next_payment_of_x_collectected_on_y", {paymentAmmount:"<strong>" + subscription.price + "</strong>", collectionDate:"<strong>" + subscription.nextPaymentDueAt + "</strong>"})}
  47. p.pull-right
  48. p
  49. a(href="/user/subscription/billing-details/edit").btn.btn-info #{translate("update_your_billing_details")}
  50. | &nbsp;
  51. a(href, ng-click="switchToCancelationView()").btn.btn-primary !{translate("cancel_your_subscription")}
  52. when "canceled"
  53. p !{translate("currently_subscribed_to_plan", {planName:"<strong>" + subscription.name + "</strong>"})}
  54. p !{translate("subscription_canceled_and_terminate_on_x", {terminateDate:"<strong>" + subscription.nextPaymentDueAt + "</strong>"})}
  55. p: form(action="/user/subscription/reactivate",method="post")
  56. input(type="hidden", name="_csrf", value=csrfToken)
  57. input(type="submit",value="Reactivate your subscription").btn.btn-success
  58. when "expired"
  59. p !{translate("your_subscription_has_expired")}
  60. a(href="/user/subscription/plans") !{translate("create_new_subscription")}
  61. default
  62. -if(groupSubscriptions.length == 0)
  63. p !{translate("problem_with_subscription_contact_us")}
  64. div(ng-show="changePlan", ng-cloak)#changePlanSection
  65. h2.col-md-7 !{translate("change_plan")}
  66. span.dropdown.col-md-1.changePlanButton(ng-controller="CurrenyDropdownController", style="display:none", dropdown)
  67. a.btn.btn-primary.dropdown-toggle(
  68. href="#",
  69. data-toggle="dropdown",
  70. dropdown-toggle
  71. )
  72. | {{currencyCode}} ({{plans[currencyCode]['symbol']}})
  73. ul.dropdown-menu(role="menu")
  74. li(ng-repeat="(currency, value) in plans", dropdown-toggle)
  75. a(
  76. href,
  77. ng-click="changeCurrency(currency)"
  78. ) {{currency}} ({{value['symbol']}})
  79. p: table.table
  80. tr
  81. th !{translate("name")}
  82. th !{translate("price")}
  83. th
  84. mixin printPlans(plans.studentAccounts)
  85. mixin printPlans(plans.individualMonthlyPlans)
  86. mixin printPlans(plans.individualAnnualPlans)
  87. each groupSubscription in groupSubscriptions
  88. - if (user._id+'' != groupSubscription.admin_id._id+'')
  89. div
  90. p !{translate("member_of_group_subscription", {admin_email: "<strong>" + groupSubscription.admin_id.email + "</strong>"})}
  91. span
  92. button.btn.btn-danger(ng-click="removeSelfFromGroup('#{groupSubscription.admin_id._id}')") #{translate("leave_group")}
  93. -if(subscription.groupPlan && user._id+'' == subscription.admin_id+'')
  94. div
  95. a(href="/subscription/group").btn.btn-primary !{translate("manage_group")}
  96. .card(ng-if="view == 'cancelation'")
  97. .page-header
  98. h1 #{translate("Cancel Subscription")}
  99. span(ng-if="sixpackOpt == 'downgrade-options'")
  100. div(ng-show="showExtendFreeTrial", style="text-align: center")
  101. p !{translate("have_more_days_to_try", {days:14})}
  102. button(type="submit", ng-click="exendTrial()", ng-disabled='inflight').btn.btn-success #{translate("ill_take_it")}
  103. p
  104. | &nbsp;
  105. p
  106. a(href, ng-click="cancelSubscription()", ng-disabled='inflight') #{translate("no_thanks_cancel_now")}
  107. div(ng-show="showDowngradeToStudent", style="text-align: center")
  108. span(ng-controller="ChangePlanFormController")
  109. p !{translate("interested_in_cheaper_plan",{price:'{{studentPrice}}'})}
  110. button(type="submit", ng-click="downgradeToStudent()", ng-disabled='inflight').btn.btn-success #{translate("yes_please")}
  111. p
  112. | &nbsp;
  113. p
  114. a(href, ng-click="cancelSubscription()", ng-disabled='inflight') #{translate("no_thanks_cancel_now")}
  115. div(ng-show="showBasicCancel")
  116. p #{translate("sure_you_want_to_cancel")}
  117. a(href="/project").btn.btn-info #{translate("i_want_to_stay")}
  118. | &nbsp;
  119. a(ng-click="cancelSubscription()", ng-disabled='inflight').btn.btn-primary #{translate("cancel_my_account")}
  120. span(ng-if="sixpackOpt == 'basic'")
  121. p #{translate("sure_you_want_to_cancel")}
  122. a(href="/project").btn.btn-info #{translate("i_want_to_stay")}
  123. | &nbsp;
  124. a(ng-click="cancelSubscription()", ng-disabled='inflight').btn.btn-primary #{translate("cancel_my_account")}
  125. script(type="text/javascript").
  126. $('#cancelSubscription').on("click", function() {
  127. ga('send', 'event', 'subscription-funnel', 'cancelation')
  128. })
  129. script(type='text/ng-template', id='confirmChangePlanModalTemplate')
  130. .modal-header
  131. h3 #{translate("change_plan")}
  132. .modal-body
  133. p !{translate("sure_you_want_to_change_plan", {planName:"<strong>{{plan.name}}</strong>"})}
  134. .modal-footer
  135. button.btn.btn-default(
  136. ng-disabled="inflight"
  137. ng-click="cancel()"
  138. ) #{translate("cancel")}
  139. button.btn.btn-success(
  140. ng-disabled="state.inflight"
  141. ng-click="confirmChangePlan()"
  142. )
  143. span(ng-hide="inflight") #{translate("change_plan")}
  144. span(ng-show="inflight") #{translate("processing")}...
  145. script(type='text/ng-template', id='LeaveGroupModalTemplate')
  146. .modal-header
  147. h3 #{translate("leave_group")}
  148. .modal-body
  149. p #{translate("sure_you_want_to_leave_group")}
  150. .modal-footer
  151. button.btn.btn-default(
  152. ng-disabled="inflight"
  153. ng-click="cancel()"
  154. ) #{translate("cancel")}
  155. button.btn.btn-danger(
  156. ng-disabled="state.inflight"
  157. ng-click="confirmLeaveGroup()"
  158. )
  159. span(ng-hide="inflight") #{translate("leave_now")}
  160. span(ng-show="inflight") #{translate("processing")}...