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.

518 lines
21 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. <h2>Invoices to Email</h2>
  140. <p id="invoice-emailing-status">
  141. {% if sub.send_invoices %}
  142. Send the invoice to
  143. {{ sub.invoice_email|default:request.user.email }}
  144. each time my payment method is successfully charged.
  145. {% else %}
  146. Do not email invoices to me.
  147. {% endif %}
  148. </p>
  149. <button
  150. data-toggle="modal"
  151. data-target="#invoice-emailing-modal"
  152. class="btn btn-default pull-right">
  153. Change Preference
  154. </button>
  155. </div>
  156. {% if send_invoices_status == "success" %}
  157. <div class="panel-footer">
  158. Your preferences have been updated!
  159. </div>
  160. {% endif %}
  161. </div>
  162. <div class="panel panel-default">
  163. <div class="panel-body settings-block">
  164. <h2>Billing History</h2>
  165. <div id="billing-history">
  166. <span class="loading">loading…</span>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. <div id="change-billing-plan-modal" class="modal">
  173. <div class="modal-dialog">
  174. {% if sub.payment_method_token and sub.address_id %}
  175. <form method="post" class="form-horizontal" action="{% url 'hc-set-plan' %}">
  176. {% csrf_token %}
  177. <div class="modal-content">
  178. <div class="modal-header">
  179. <button type="button" class="close" data-dismiss="modal">&times;</button>
  180. <h4 class="remove-check-title">Change Billing Plan</h4>
  181. </div>
  182. <div class="modal-body">
  183. <h2>Free <small>20 checks, 3 team members</small></h2>
  184. <label class="radio-container">
  185. <input
  186. type="radio"
  187. name="plan_id"
  188. value=""
  189. {% if sub.plan_id == "" %} checked {% endif %}>
  190. <span class="radiomark"></span>
  191. Enjoy free service.
  192. </label>
  193. <h2>Standard <small>50 checks, 10 team members</small></h2>
  194. <label class="radio-container">
  195. <input
  196. type="radio"
  197. name="plan_id"
  198. value="P20"
  199. {% if sub.plan_id == "P20" %} checked {% endif %}>
  200. <span class="radiomark"></span>
  201. Monthly, $20 / month
  202. </label>
  203. <label class="radio-container">
  204. <input
  205. type="radio"
  206. name="plan_id"
  207. value="Y192"
  208. {% if sub.plan_id == "Y192" %} checked {% endif %}>
  209. <span class="radiomark"></span>
  210. Annual, $192 / year (20% off monthly)
  211. </label>
  212. <h2>Plus <small>500 checks, unlimited team members</small></h2>
  213. <label class="radio-container">
  214. <input
  215. type="radio"
  216. name="plan_id"
  217. value="P80"
  218. {% if sub.plan_id == "P80" %} checked {% endif %}>
  219. <span class="radiomark"></span>
  220. Monthly, $80/month
  221. </label>
  222. <label class="radio-container">
  223. <input
  224. type="radio"
  225. name="plan_id"
  226. value="Y768"
  227. {% if sub.plan_id == "Y768" %} checked {% endif %}>
  228. <span class="radiomark"></span>
  229. Annual, $768/year (20% off monthly)
  230. </label>
  231. <div class="alert alert-warning">
  232. <strong>No proration.</strong> We currently do not
  233. support proration when changing billing plans.
  234. Changing the plan starts a new billing cycle
  235. and charges your payment method.
  236. </div>
  237. </div>
  238. <div class="modal-footer">
  239. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  240. <button type="submit" class="btn btn-primary">
  241. Change Billing Plan
  242. </button>
  243. </div>
  244. </div>
  245. </form>
  246. {% else %}
  247. <div class="modal-content">
  248. <div class="modal-header">
  249. <button type="button" class="close" data-dismiss="modal">&times;</button>
  250. <h4>Some details are missing…</h4>
  251. </div>
  252. <div class="modal-body">
  253. {% if not sub.payment_method_token %}
  254. <div id="no-payment-method">
  255. <h4>No payment method.</h4>
  256. <p>Please add a payment method before changing the billing
  257. plan.
  258. </p>
  259. </div>
  260. {% endif %}
  261. {% if not sub.address_id %}
  262. <div id="no-billing-address">
  263. <h4>No billing address.</h4>
  264. <p>Please add a billing address before changing
  265. the billing plan.
  266. </p>
  267. </div>
  268. {% endif %}
  269. </div>
  270. <div class="modal-footer">
  271. <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
  272. </div>
  273. </div>
  274. {% endif %}
  275. </div>
  276. </div>
  277. <div id="payment-method-modal" class="modal pm-modal">
  278. <div class="modal-dialog">
  279. <form id="payment-form" method="post" action="{% url 'hc-payment-method' %}">
  280. {% csrf_token %}
  281. <input id="pmm-nonce" type="hidden" name="payment_method_nonce" />
  282. <div class="modal-content">
  283. <div class="modal-header">
  284. <button type="button" class="close" data-dismiss="modal">&times;</button>
  285. <h4>Payment Method</h4>
  286. </div>
  287. <div class="modal-body">
  288. <div id="dropin"></div>
  289. </div>
  290. <div class="modal-footer">
  291. <button type="button" class="btn btn-default" data-dismiss="modal">
  292. Cancel
  293. </button>
  294. <button id="payment-form-submit" type="button" class="btn btn-primary" disabled>
  295. Confirm Payment Method
  296. </button>
  297. </div>
  298. </div>
  299. </form>
  300. </div>
  301. </div>
  302. <div id="billing-address-modal" class="modal">
  303. <div class="modal-dialog">
  304. <form action="{% url 'hc-billing-address' %}" method="post">
  305. {% csrf_token %}
  306. <div class="modal-content">
  307. <div class="modal-header">
  308. <button type="button" class="close" data-dismiss="modal">&times;</button>
  309. <h4>Billing Address</h4>
  310. </div>
  311. <div class="modal-body">
  312. <div class="row">
  313. <div class="col-sm-6">
  314. <div class="form-group">
  315. <input
  316. id="first_name"
  317. name="first_name"
  318. type="text"
  319. placeholder="First Name"
  320. class="form-control" />
  321. </div>
  322. </div>
  323. <div class="col-sm-6">
  324. <div class="form-group">
  325. <input
  326. id="last_name"
  327. name="last_name"
  328. type="text"
  329. placeholder="Last Name"
  330. class="input-name form-control" />
  331. </div>
  332. </div>
  333. </div>
  334. <div class="row">
  335. <div class="col-sm-8">
  336. <div class="form-group">
  337. <input
  338. id="company"
  339. name="company"
  340. placeholder="Company (optional)"
  341. type="text"
  342. class="form-control" />
  343. </div>
  344. </div>
  345. <div class="col-sm-4">
  346. <div class="form-group">
  347. <input
  348. id="extended_address"
  349. name="extended_address"
  350. placeholder="VAT ID (optional)"
  351. type="text"
  352. class="form-control" />
  353. </div>
  354. </div>
  355. <div class="col-sm-12">
  356. <div class="form-group">
  357. <input
  358. id="street_address"
  359. name="street_address"
  360. placeholder="Street Address"
  361. type="text"
  362. class="form-control" />
  363. </div>
  364. </div>
  365. <div class="col-sm-6">
  366. <div class="form-group">
  367. <input
  368. id="locality"
  369. name="locality"
  370. placeholder="City"
  371. type="text"
  372. class="form-control" />
  373. </div>
  374. </div>
  375. <div class="col-sm-6">
  376. <div class="form-group">
  377. <input
  378. id="region"
  379. name="region"
  380. placeholder="State / Region"
  381. type="text"
  382. class="form-control" />
  383. </div>
  384. </div>
  385. <div class="col-sm-6">
  386. <div class="form-group">
  387. <input
  388. id="postal_code"
  389. name="postal_code"
  390. placeholder="Postal Code"
  391. type="text"
  392. class="form-control" />
  393. </div>
  394. </div>
  395. <div class="col-sm-6">
  396. <div class="form-group">
  397. <select id="country_code_alpha2" class="form-control" name="country_code_alpha2">
  398. {% include "payments/countries.html" %}
  399. </select>
  400. </div>
  401. </div>
  402. </div>
  403. </div>
  404. <div class="modal-footer">
  405. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  406. <button type="submit" class="btn btn-primary">Save</button>
  407. </div>
  408. </div>
  409. </form>
  410. </div>
  411. </div>
  412. <div id="invoice-emailing-modal" class="modal pm-modal">
  413. <div class="modal-dialog">
  414. <form method="post">
  415. {% csrf_token %}
  416. <div class="modal-content">
  417. <div class="modal-header">
  418. <button type="button" class="close" data-dismiss="modal">&times;</button>
  419. <h4>Invoices to Email</h4>
  420. </div>
  421. <div class="modal-body">
  422. <label class="radio-container">
  423. <input
  424. type="radio"
  425. name="send_invoices"
  426. value="0"
  427. {% if not sub.send_invoices %} checked {% endif %}>
  428. <span class="radiomark"></span>
  429. Do not email invoices to me
  430. </label>
  431. <label class="radio-container">
  432. <input
  433. type="radio"
  434. name="send_invoices"
  435. value="1"
  436. {% if sub.send_invoices and not sub.invoice_email %} checked {% endif %}>
  437. <span class="radiomark"></span>
  438. Send invoices to {{ profile.user.email }}
  439. </label>
  440. <label class="radio-container">
  441. <input
  442. type="radio"
  443. name="send_invoices"
  444. value="2"
  445. {% if sub.send_invoices and sub.invoice_email %} checked {% endif %}>
  446. <span class="radiomark"></span>
  447. Send invoices to this email address:
  448. </label>
  449. <input
  450. id="invoice-email"
  451. name="invoice_email"
  452. placeholder="[email protected]"
  453. value="{{ sub.invoice_email }}"
  454. type="email"
  455. class="form-control" />
  456. </div>
  457. <div class="modal-footer">
  458. <button type="button" class="btn btn-default" data-dismiss="modal">
  459. Cancel
  460. </button>
  461. <button type="submit" class="btn btn-primary">
  462. Save Changes
  463. </button>
  464. </div>
  465. </div>
  466. </form>
  467. </div>
  468. </div>
  469. {% endblock %}
  470. {% block scripts %}
  471. <script src="https://js.braintreegateway.com/web/dropin/1.8.0/js/dropin.min.js"></script>
  472. {% compress js %}
  473. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  474. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  475. <script src="{% static 'js/billing.js' %}"></script>
  476. {% endcompress %}
  477. {% endblock %}