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.

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