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.

540 lines
22 KiB

  1. {% extends "base.html" %}
  2. {% load compress static 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 Details</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 Details
  127. </button>
  128. </div>
  129. {% if address_status == "success" %}
  130. <div class="panel-footer">
  131. Your billing details have 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" autocomplete="off" action="{% url 'hc-set-plan' %}">
  176. {% csrf_token %}
  177. <input type="hidden" id="old-plan-id" value="{{ sub.plan_id }}">
  178. <input type="hidden" id="plan-id" name="plan_id" value="{{ sub.plan_id }}">
  179. <div class="modal-content">
  180. <div class="modal-header">
  181. <button type="button" class="close" data-dismiss="modal">&times;</button>
  182. <h4 class="remove-check-title">Change Billing Plan</h4>
  183. </div>
  184. <div class="modal-body">
  185. <div class="row">
  186. <div class="col-sm-4">
  187. <div id="plan-hobbyist" class="panel plan {% if sub.plan_id == "" %}selected{% endif %}">
  188. <div class="marker">Selected Plan</div>
  189. <h2>Hobbyist</h2>
  190. <ul>
  191. <li>Checks: 20</li>
  192. <li>Team members: 3</li>
  193. <li>Log entries: 100</li>
  194. </ul>
  195. <h3>Free</h3>
  196. </div>
  197. </div>
  198. <div class="col-sm-4">
  199. <div id="plan-business" class="panel plan {% if sub.plan_id == "P20" or sub.plan_id == "Y192" %}selected{% endif %}">
  200. <div class="marker">Selected Plan</div>
  201. <h2>Business</h2>
  202. <ul>
  203. <li>Checks: 100</li>
  204. <li>Team members: 10</li>
  205. <li>Log entries: 1000</li>
  206. </ul>
  207. <h3>
  208. <span id="business-price"></span>
  209. <small>/ month</small>
  210. </h3>
  211. </div>
  212. </div>
  213. <div class="col-sm-4">
  214. <div id="plan-business-plus" class="panel plan {% if sub.plan_id == "P80" or sub.plan_id == "Y768" %}selected{% endif %}">
  215. <div class="marker">Selected Plan</div>
  216. <h2>Business Plus</h2>
  217. <ul>
  218. <li>Checks: 1000</li>
  219. <li>Team members: Unlimited</li>
  220. <li>Log entries: 1000</li>
  221. </ul>
  222. <h3>
  223. <span id="business-plus-price"></span>
  224. <small>/ month</small>
  225. </h3>
  226. </div>
  227. </div>
  228. </div>
  229. <div class="row">
  230. <div id="billing-periods" class="col-sm-6">
  231. <p>Billing Period</p>
  232. <label class="radio-container">
  233. <input
  234. id="billing-monthly"
  235. type="radio"
  236. name="billing_period"
  237. value="monthly"
  238. {% if sub.plan_id == "Y192" or sub.plan_id == "Y768" %}{% else %}checked{% endif %}>
  239. <span class="radiomark"></span>
  240. Monthly
  241. </label>
  242. <label class="radio-container">
  243. <input
  244. id="billing-annual"
  245. type="radio"
  246. name="billing_period"
  247. value="annual"
  248. {% if sub.plan_id == "Y192" or sub.plan_id == "Y768" %} checked {% endif %}>
  249. <span class="radiomark"></span>
  250. Annual, 20% off
  251. </label>
  252. </div>
  253. </div>
  254. <div class="text-warning">
  255. <strong>No proration.</strong> We currently do not
  256. support proration when changing billing plans.
  257. Changing the plan starts a new billing cycle
  258. and charges your payment method.
  259. </div>
  260. </div>
  261. <div class="modal-footer">
  262. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  263. <button id="change-plan-btn" type="submit" class="btn btn-primary" disabled="disabled">
  264. Change Billing Plan
  265. </button>
  266. </div>
  267. </div>
  268. </form>
  269. {% else %}
  270. <div class="modal-content">
  271. <div class="modal-header">
  272. <button type="button" class="close" data-dismiss="modal">&times;</button>
  273. <h4>Some details are missing…</h4>
  274. </div>
  275. <div class="modal-body">
  276. {% if not sub.payment_method_token %}
  277. <div id="no-payment-method">
  278. <h4>No payment method.</h4>
  279. <p>Please add a payment method before changing the billing
  280. plan.
  281. </p>
  282. </div>
  283. {% endif %}
  284. {% if not sub.address_id %}
  285. <div id="no-billing-address">
  286. <h4>Country not specified.</h4>
  287. <p>For tax accounting purposes, please specify
  288. your <strong>Country</strong> in the "Billing Details"
  289. section.
  290. </p>
  291. <p>
  292. Optionally, add your
  293. <strong>company name</strong>, <strong>address</strong>
  294. and <strong>VAT ID</strong>
  295. to have them displayed on invoices.
  296. </p>
  297. </div>
  298. {% endif %}
  299. </div>
  300. <div class="modal-footer">
  301. <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
  302. </div>
  303. </div>
  304. {% endif %}
  305. </div>
  306. </div>
  307. <div id="payment-method-modal" class="modal pm-modal">
  308. <div class="modal-dialog">
  309. <form id="payment-form" method="post" action="{% url 'hc-payment-method' %}">
  310. {% csrf_token %}
  311. <input id="pmm-nonce" type="hidden" name="payment_method_nonce" />
  312. <div class="modal-content">
  313. <div class="modal-header">
  314. <button type="button" class="close" data-dismiss="modal">&times;</button>
  315. <h4>Payment Method</h4>
  316. </div>
  317. <div class="modal-body">
  318. <div id="dropin"></div>
  319. </div>
  320. <div class="modal-footer">
  321. <button type="button" class="btn btn-default" data-dismiss="modal">
  322. Cancel
  323. </button>
  324. <button id="payment-form-submit" type="button" class="btn btn-primary" disabled>
  325. Confirm Payment Method
  326. </button>
  327. </div>
  328. </div>
  329. </form>
  330. </div>
  331. </div>
  332. <div id="billing-address-modal" class="modal">
  333. <div class="modal-dialog">
  334. <form action="{% url 'hc-billing-address' %}" method="post">
  335. {% csrf_token %}
  336. <div class="modal-content">
  337. <div class="modal-header">
  338. <button type="button" class="close" data-dismiss="modal">&times;</button>
  339. <h4>Billing Details</h4>
  340. </div>
  341. <div class="modal-body">
  342. <div class="row">
  343. <div class="col-sm-8">
  344. <div class="form-group">
  345. <label for="company">
  346. Company
  347. </label>
  348. <input
  349. id="company"
  350. name="company"
  351. type="text"
  352. class="form-control" />
  353. </div>
  354. </div>
  355. <div class="col-sm-4">
  356. <div class="form-group">
  357. <label for="extended_address">
  358. VAT ID
  359. </label>
  360. <input
  361. id="extended_address"
  362. name="extended_address"
  363. type="text"
  364. class="form-control" />
  365. </div>
  366. </div>
  367. <div class="col-sm-12">
  368. <div class="form-group">
  369. <label for="company">Street Address</label>
  370. <input
  371. id="street_address"
  372. name="street_address"
  373. type="text"
  374. class="form-control" />
  375. </div>
  376. </div>
  377. <div class="col-sm-6">
  378. <label for="locality">
  379. City
  380. </label>
  381. <div class="form-group">
  382. <input
  383. id="locality"
  384. name="locality"
  385. type="text"
  386. class="form-control" />
  387. </div>
  388. </div>
  389. <div class="col-sm-6">
  390. <div class="form-group">
  391. <label for="region">
  392. State / Region
  393. </label>
  394. <input
  395. id="region"
  396. name="region"
  397. type="text"
  398. class="form-control" />
  399. </div>
  400. </div>
  401. <div class="col-sm-6">
  402. <div class="form-group">
  403. <label for="postal_Code">
  404. Postal Code
  405. </label>
  406. <input
  407. id="postal_code"
  408. name="postal_code"
  409. type="text"
  410. class="form-control" />
  411. </div>
  412. </div>
  413. <div class="col-sm-6">
  414. <div class="form-group">
  415. <label for="country_code_alpha2">
  416. Country
  417. </label>
  418. <select id="country_code_alpha2" class="form-control" name="country_code_alpha2">
  419. {% include "payments/countries.html" %}
  420. </select>
  421. </div>
  422. </div>
  423. </div>
  424. </div>
  425. <div class="modal-footer">
  426. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  427. <button type="submit" class="btn btn-primary">Save</button>
  428. </div>
  429. </div>
  430. </form>
  431. </div>
  432. </div>
  433. <div id="invoice-emailing-modal" class="modal pm-modal">
  434. <div class="modal-dialog">
  435. <form method="post">
  436. {% csrf_token %}
  437. <div class="modal-content">
  438. <div class="modal-header">
  439. <button type="button" class="close" data-dismiss="modal">&times;</button>
  440. <h4>Invoices to Email</h4>
  441. </div>
  442. <div class="modal-body">
  443. <label class="radio-container">
  444. <input
  445. type="radio"
  446. name="send_invoices"
  447. value="0"
  448. {% if not sub.send_invoices %} checked {% endif %}>
  449. <span class="radiomark"></span>
  450. Do not email invoices to me
  451. </label>
  452. <label class="radio-container">
  453. <input
  454. type="radio"
  455. name="send_invoices"
  456. value="1"
  457. {% if sub.send_invoices and not sub.invoice_email %} checked {% endif %}>
  458. <span class="radiomark"></span>
  459. Send invoices to {{ profile.user.email }}
  460. </label>
  461. <label class="radio-container">
  462. <input
  463. type="radio"
  464. name="send_invoices"
  465. value="2"
  466. {% if sub.send_invoices and sub.invoice_email %} checked {% endif %}>
  467. <span class="radiomark"></span>
  468. Send invoices to this email address:
  469. </label>
  470. <input
  471. id="invoice-email"
  472. name="invoice_email"
  473. placeholder="[email protected]"
  474. value="{{ sub.invoice_email }}"
  475. type="email"
  476. class="form-control" />
  477. </div>
  478. <div class="modal-footer">
  479. <button type="button" class="btn btn-default" data-dismiss="modal">
  480. Cancel
  481. </button>
  482. <button type="submit" class="btn btn-primary">
  483. Save Changes
  484. </button>
  485. </div>
  486. </div>
  487. </form>
  488. </div>
  489. </div>
  490. {% endblock %}
  491. {% block scripts %}
  492. <script src="https://js.braintreegateway.com/web/dropin/1.8.0/js/dropin.min.js"></script>
  493. {% compress js %}
  494. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  495. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  496. <script src="{% static 'js/billing.js' %}"></script>
  497. {% endcompress %}
  498. {% endblock %}