You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

459 lines
19 KiB

  1. {% extends "base.html" %}
  2. {% load compress staticfiles hc_extras %}
  3. {% block title %}Account Settings - {% site_name %}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <h1 class="settings-title">Settings</h1>
  8. </div>
  9. </div>
  10. <div class="row">
  11. <div class="col-sm-3">
  12. <ul class="nav nav-pills nav-stacked">
  13. <li><a href="{% url 'hc-profile' %}">Account</a></li>
  14. <li class="active"><a href="{% url 'hc-billing' %}">Billing</a></li>
  15. <li><a href="{% url 'hc-notifications' %}">Email Reports</a></li>
  16. <li><a href="{% url 'hc-badges' %}">Badges</a></li>
  17. </ul>
  18. </div>
  19. <div class="col-sm-9 col-md-9">
  20. {% if messages %}
  21. <div class="alert alert-danger">
  22. <p>
  23. <strong>We're sorry!</strong> There was a problem setting
  24. up the subscription. Response from payment gateway:</p>
  25. {% for message in messages %}
  26. <p class="error-message">{{ message }}</p>
  27. {% endfor %}
  28. </div>
  29. {% endif %}
  30. <div class="row">
  31. <div class="col-sm-6">
  32. <div class="panel panel-{{ set_plan_status }}">
  33. <div class="panel-body settings-block">
  34. <h2>Billing Plan</h2>
  35. <table class="table">
  36. <tr>
  37. <td>Current Plan</td>
  38. <td>
  39. {% if sub is None or sub.plan_id == "" %}
  40. Free
  41. {% else %}
  42. {{ sub.plan_name }}
  43. {% endif %}
  44. </td>
  45. </tr>
  46. {% if sub.plan_id %}
  47. <tr>
  48. <td>Next Payment</td>
  49. <td id="next-billing-date">
  50. <span class="loading">loading…</span>
  51. </td>
  52. </tr>
  53. {% endif %}
  54. <tr>
  55. <td>Checks Used</td>
  56. <td {% if num_checks >= profile.check_limit %} class="at-limit" {% endif %}>
  57. <span>{{ num_checks }} of {{ profile.check_limit }}</span>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td>Team Size</td>
  62. <td {% if team_size >= profile.team_limit %} class="at-limit" {% endif %}>
  63. <span>
  64. {{ team_size }} of
  65. {% if profile.team_limit == 500 %}
  66. unlimited
  67. {% else %}
  68. {{ team_max }}
  69. {% endif %}
  70. </span>
  71. </td>
  72. </tr>
  73. </table>
  74. <button
  75. data-toggle="modal"
  76. data-target="#change-billing-plan-modal"
  77. class="btn btn-default pull-right">
  78. Change Billing Plan
  79. </button>
  80. </div>
  81. {% if set_plan_status == "success" %}
  82. <div class="panel-footer">
  83. Your billing plan has been updated!
  84. </div>
  85. {% endif %}
  86. </div>
  87. <div class="panel panel-{{ payment_method_status }}">
  88. <div class="panel-body settings-block">
  89. <h2>Payment Method</h2>
  90. {% if sub.payment_method_token %}
  91. <p id="payment-method">
  92. <span class="loading">loading…</span>
  93. </p>
  94. {% else %}
  95. <p id="payment-method-missing" class="billing-empty">Not set</p>
  96. {% endif %}
  97. <button
  98. id="update-payment-method"
  99. class="btn btn-default pull-right">
  100. Change Payment Method</button>
  101. </div>
  102. {% if payment_method_status == "success" %}
  103. <div class="panel-footer">
  104. Your payment method has been updated!
  105. </div>
  106. {% endif %}
  107. </div>
  108. </div>
  109. <div class="col-sm-6">
  110. <div class="panel panel-{{ address_status }}">
  111. <div class="panel-body settings-block">
  112. <h2>Billing Address</h2>
  113. {% if sub.address_id %}
  114. <div id="billing-address">
  115. <span class="loading">loading…</span>
  116. </div>
  117. {% else %}
  118. <p id="billing-address-missing" class="billing-empty">
  119. Not set
  120. </p>
  121. {% endif %}
  122. <button
  123. data-toggle="modal"
  124. data-target="#billing-address-modal"
  125. class="btn btn-default pull-right">
  126. Change Billing Address
  127. </button>
  128. </div>
  129. {% if address_status == "success" %}
  130. <div class="panel-footer">
  131. Your billing address has been updated!
  132. </div>
  133. {% endif %}
  134. </div>
  135. </div>
  136. </div>
  137. <div class="panel panel-{{ send_invoices_status }}">
  138. <div class="panel-body settings-block">
  139. <form method="post">
  140. {% csrf_token %}
  141. <h2>Invoices to Email</h2>
  142. <label class="checkbox-container">
  143. <input
  144. name="send_invoices"
  145. type="checkbox"
  146. {% if sub.send_invoices %}checked{% endif %}>
  147. <span class="checkmark"></span>
  148. Send the invoice to {{ request.user.email }}
  149. each time my payment method is successfully charged.
  150. </label>
  151. <button
  152. type="submit"
  153. name="save_send_invoices"
  154. class="btn btn-default pull-right">
  155. Save Changes
  156. </button>
  157. </form>
  158. </div>
  159. {% if send_invoices_status == "success" %}
  160. <div class="panel-footer">
  161. Your preferences have been updated!
  162. </div>
  163. {% endif %}
  164. </div>
  165. <div class="panel panel-default">
  166. <div class="panel-body settings-block">
  167. <h2>Billing History</h2>
  168. <div id="billing-history">
  169. <span class="loading">loading…</span>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. <div id="change-billing-plan-modal" class="modal">
  176. <div class="modal-dialog">
  177. {% if sub.payment_method_token and sub.address_id %}
  178. <form method="post" class="form-horizontal" action="{% url 'hc-set-plan' %}">
  179. {% csrf_token %}
  180. <div class="modal-content">
  181. <div class="modal-header">
  182. <button type="button" class="close" data-dismiss="modal">&times;</button>
  183. <h4 class="remove-check-title">Change Billing Plan</h4>
  184. </div>
  185. <div class="modal-body">
  186. <h2>Free <small>20 checks, 3 team members</small></h2>
  187. <label class="radio-container">
  188. <input
  189. type="radio"
  190. name="plan_id"
  191. value=""
  192. {% if sub.plan_id == "" %} checked {% endif %}>
  193. <span class="radiomark"></span>
  194. Enjoy free service.
  195. </label>
  196. <h2>Standard <small>50 checks, 10 team members</small></h2>
  197. <label class="radio-container">
  198. <input
  199. type="radio"
  200. name="plan_id"
  201. value="P20"
  202. {% if sub.plan_id == "P20" %} checked {% endif %}>
  203. <span class="radiomark"></span>
  204. Monthly, $20 / month
  205. </label>
  206. <label class="radio-container">
  207. <input
  208. type="radio"
  209. name="plan_id"
  210. value="Y192"
  211. {% if sub.plan_id == "Y192" %} checked {% endif %}>
  212. <span class="radiomark"></span>
  213. Annual, $192 / year (20% off monthly)
  214. </label>
  215. <h2>Plus <small>500 checks, unlimited team members</small></h2>
  216. <label class="radio-container">
  217. <input
  218. type="radio"
  219. name="plan_id"
  220. value="P80"
  221. {% if sub.plan_id == "P80" %} checked {% endif %}>
  222. <span class="radiomark"></span>
  223. Monthly, $80/month
  224. </label>
  225. <label class="radio-container">
  226. <input
  227. type="radio"
  228. name="plan_id"
  229. value="Y768"
  230. {% if sub.plan_id == "Y768" %} checked {% endif %}>
  231. <span class="radiomark"></span>
  232. Annual, $768/year (20% off monthly)
  233. </label>
  234. <div class="alert alert-warning">
  235. <strong>No proration.</strong> We currently do not
  236. support proration when changing billing plans.
  237. Changing the plan starts a new billing cycle
  238. and charges your payment method.
  239. </div>
  240. </div>
  241. <div class="modal-footer">
  242. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  243. <button type="submit" class="btn btn-primary">
  244. Change Billing Plan
  245. </button>
  246. </div>
  247. </div>
  248. </form>
  249. {% else %}
  250. <div class="modal-content">
  251. <div class="modal-header">
  252. <button type="button" class="close" data-dismiss="modal">&times;</button>
  253. <h4>Some details are missing…</h4>
  254. </div>
  255. <div class="modal-body">
  256. {% if not sub.payment_method_token %}
  257. <div id="no-payment-method">
  258. <h4>No payment method.</h4>
  259. <p>Please add a payment method before changing the billing
  260. plan.
  261. </p>
  262. </div>
  263. {% endif %}
  264. {% if not sub.address_id %}
  265. <div id="no-billing-address">
  266. <h4>No billing address.</h4>
  267. <p>Please add a billing address before changing
  268. the billing plan.
  269. </p>
  270. </div>
  271. {% endif %}
  272. </div>
  273. <div class="modal-footer">
  274. <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
  275. </div>
  276. </div>
  277. {% endif %}
  278. </div>
  279. </div>
  280. <div id="payment-method-modal" class="modal pm-modal">
  281. <div class="modal-dialog">
  282. <form id="payment-form" method="post" action="{% url 'hc-payment-method' %}">
  283. {% csrf_token %}
  284. <input id="pmm-nonce" type="hidden" name="payment_method_nonce" />
  285. <div class="modal-content">
  286. <div class="modal-header">
  287. <button type="button" class="close" data-dismiss="modal">&times;</button>
  288. <h4>Payment Method</h4>
  289. </div>
  290. <div class="modal-body">
  291. <div id="dropin"></div>
  292. </div>
  293. <div class="modal-footer">
  294. <button type="button" class="btn btn-default" data-dismiss="modal">
  295. Cancel
  296. </button>
  297. <button id="payment-form-submit" type="button" class="btn btn-primary" disabled>
  298. Confirm Payment Method
  299. </button>
  300. </div>
  301. </div>
  302. </form>
  303. </div>
  304. </div>
  305. <div id="billing-address-modal" class="modal">
  306. <div class="modal-dialog">
  307. <form action="{% url 'hc-billing-address' %}" method="post">
  308. {% csrf_token %}
  309. <div class="modal-content">
  310. <div class="modal-header">
  311. <button type="button" class="close" data-dismiss="modal">&times;</button>
  312. <h4>Billing Address</h4>
  313. </div>
  314. <div class="modal-body">
  315. <div class="row">
  316. <div class="col-sm-6">
  317. <div class="form-group">
  318. <input
  319. id="first_name"
  320. name="first_name"
  321. type="text"
  322. placeholder="First Name"
  323. class="form-control" />
  324. </div>
  325. </div>
  326. <div class="col-sm-6">
  327. <div class="form-group">
  328. <input
  329. id="last_name"
  330. name="last_name"
  331. type="text"
  332. placeholder="Last Name"
  333. class="input-name form-control" />
  334. </div>
  335. </div>
  336. </div>
  337. <div class="row">
  338. <div class="col-sm-8">
  339. <div class="form-group">
  340. <input
  341. id="company"
  342. name="company"
  343. placeholder="Company (optional)"
  344. type="text"
  345. class="form-control" />
  346. </div>
  347. </div>
  348. <div class="col-sm-4">
  349. <div class="form-group">
  350. <input
  351. id="extended_address"
  352. name="extended_address"
  353. placeholder="VAT ID (optional)"
  354. type="text"
  355. class="form-control" />
  356. </div>
  357. </div>
  358. <div class="col-sm-12">
  359. <div class="form-group">
  360. <input
  361. id="street_address"
  362. name="street_address"
  363. placeholder="Street Address"
  364. type="text"
  365. class="form-control" />
  366. </div>
  367. </div>
  368. <div class="col-sm-6">
  369. <div class="form-group">
  370. <input
  371. id="locality"
  372. name="locality"
  373. placeholder="City"
  374. type="text"
  375. class="form-control" />
  376. </div>
  377. </div>
  378. <div class="col-sm-6">
  379. <div class="form-group">
  380. <input
  381. id="region"
  382. name="region"
  383. placeholder="State / Region"
  384. type="text"
  385. class="form-control" />
  386. </div>
  387. </div>
  388. <div class="col-sm-6">
  389. <div class="form-group">
  390. <input
  391. id="postal_code"
  392. name="postal_code"
  393. placeholder="Postal Code"
  394. type="text"
  395. class="form-control" />
  396. </div>
  397. </div>
  398. <div class="col-sm-6">
  399. <div class="form-group">
  400. <select id="country_code_alpha2" class="form-control" name="country_code_alpha2">
  401. {% include "payments/countries.html" %}
  402. </select>
  403. </div>
  404. </div>
  405. </div>
  406. </div>
  407. <div class="modal-footer">
  408. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  409. <button type="submit" class="btn btn-primary">Save</button>
  410. </div>
  411. </div>
  412. </form>
  413. </div>
  414. </div>
  415. {% endblock %}
  416. {% block scripts %}
  417. <script src="https://js.braintreegateway.com/web/dropin/1.8.0/js/dropin.min.js"></script>
  418. {% compress js %}
  419. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  420. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  421. <script src="{% static 'js/billing.js' %}"></script>
  422. {% endcompress %}
  423. {% endblock %}