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.

526 lines
21 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">
  8. Settings
  9. <small>{{ request.user.email}}</small>
  10. </h1>
  11. </div>
  12. </div>
  13. <div class="row">
  14. <div class="col-sm-3">
  15. <ul class="nav nav-pills nav-stacked">
  16. <li><a href="{% url 'hc-profile' %}">Account</a></li>
  17. <li class="active"><a href="{% url 'hc-billing' %}">Billing</a></li>
  18. <li><a href="{% url 'hc-notifications' %}">Email Reports</a></li>
  19. </ul>
  20. </div>
  21. <div class="col-sm-9 col-md-9">
  22. {% if messages %}
  23. <div class="alert alert-danger">
  24. <p>
  25. <strong>We're sorry!</strong> There was a problem setting
  26. up the subscription. Response from payment gateway:</p>
  27. {% for message in messages %}
  28. <p class="error-message">{{ message }}</p>
  29. {% endfor %}
  30. </div>
  31. {% endif %}
  32. <div class="row">
  33. <div class="col-sm-6">
  34. <div class="panel panel-{{ set_plan_status }}">
  35. <div class="panel-body settings-block">
  36. <h2>Billing Plan</h2>
  37. <table class="table">
  38. <tr>
  39. <td>Current Plan</td>
  40. <td>{{ sub.plan_name|default:"Hobbyist" }}</td>
  41. </tr>
  42. {% if sub.plan_id %}
  43. <tr>
  44. <td>Next Payment</td>
  45. <td id="next-billing-date">
  46. <span class="loading">loading…</span>
  47. </td>
  48. </tr>
  49. {% endif %}
  50. <tr>
  51. <td>Checks Used</td>
  52. <td {% if num_checks >= profile.check_limit %} class="at-limit" {% endif %}>
  53. <span>{{ num_checks }} of {{ profile.check_limit }}</span>
  54. </td>
  55. </tr>
  56. </table>
  57. <button
  58. data-toggle="modal"
  59. data-target="#change-billing-plan-modal"
  60. class="btn btn-default pull-right">
  61. Change Billing Plan
  62. </button>
  63. </div>
  64. {% if set_plan_status == "success" %}
  65. <div class="panel-footer">
  66. Your billing plan has been updated!
  67. </div>
  68. {% endif %}
  69. </div>
  70. {% if sub.subscription_id %}
  71. <div class="panel panel-{{ payment_method_status }}">
  72. <div class="panel-body settings-block">
  73. <h2>Payment Method</h2>
  74. <p id="payment-method">
  75. <span class="loading">loading…</span>
  76. </p>
  77. <button
  78. id="update-payment-method"
  79. class="btn btn-default pull-right">
  80. Change Payment Method</button>
  81. </div>
  82. {% if payment_method_status == "success" %}
  83. <div class="panel-footer">
  84. Your payment method has been updated!
  85. </div>
  86. {% endif %}
  87. </div>
  88. {% endif %}
  89. </div>
  90. <div class="col-sm-6">
  91. <div class="panel panel-{{ address_status }}">
  92. <div class="panel-body settings-block">
  93. <h2>Billing Details</h2>
  94. {% if sub.address_id %}
  95. <div id="billing-address">
  96. <span class="loading">loading…</span>
  97. </div>
  98. {% else %}
  99. <p id="billing-address-missing" class="billing-empty">
  100. Not set
  101. </p>
  102. {% endif %}
  103. <button
  104. data-toggle="modal"
  105. data-target="#billing-address-modal"
  106. class="btn btn-default pull-right">
  107. Change Billing Details
  108. </button>
  109. </div>
  110. {% if address_status == "success" %}
  111. <div class="panel-footer">
  112. Your billing details have been updated!
  113. </div>
  114. {% endif %}
  115. </div>
  116. </div>
  117. </div>
  118. <div class="panel panel-{{ send_invoices_status }}">
  119. <div class="panel-body settings-block">
  120. <h2>Invoices to Email</h2>
  121. <p id="invoice-emailing-status">
  122. {% if sub.send_invoices %}
  123. Send the invoice to
  124. {{ sub.invoice_email|default:request.user.email }}
  125. each time my payment method is successfully charged.
  126. {% else %}
  127. Do not email invoices to me.
  128. {% endif %}
  129. </p>
  130. <button
  131. data-toggle="modal"
  132. data-target="#invoice-emailing-modal"
  133. class="btn btn-default pull-right">
  134. Change Preference
  135. </button>
  136. </div>
  137. {% if send_invoices_status == "success" %}
  138. <div class="panel-footer">
  139. Your preferences have been updated!
  140. </div>
  141. {% endif %}
  142. </div>
  143. <div class="panel panel-default">
  144. <div class="panel-body settings-block">
  145. <h2>Billing History</h2>
  146. <div id="billing-history">
  147. <span class="loading">loading…</span>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. <div id="change-billing-plan-modal" class="modal">
  154. <div class="modal-dialog">
  155. {% if sub.address_id %}
  156. <div class="modal-content">
  157. <div class="modal-header">
  158. <button type="button" class="close" data-dismiss="modal">&times;</button>
  159. <h4>Change Billing Plan</h4>
  160. </div>
  161. <div class="modal-body">
  162. <div class="row">
  163. <div class="col-sm-4">
  164. <div id="plan-hobbyist" class="panel plan {% if sub.plan_id == "" %}selected{% endif %}">
  165. <div class="marker">Selected Plan</div>
  166. <h2>Hobbyist</h2>
  167. <ul>
  168. <li>Checks: 20</li>
  169. <li>Team members: 3</li>
  170. <li>Log entries: 100</li>
  171. </ul>
  172. <h3>Free</h3>
  173. </div>
  174. </div>
  175. <div class="col-sm-4">
  176. <div id="plan-business" class="panel plan {% if sub.plan_id == "P20" or sub.plan_id == "Y192" %}selected{% endif %}">
  177. <div class="marker">Selected Plan</div>
  178. <h2>Business</h2>
  179. <ul>
  180. <li>Checks: 100</li>
  181. <li>Team members: 10</li>
  182. <li>Log entries: 1000</li>
  183. </ul>
  184. <h3>
  185. <span id="business-price"></span>
  186. <small>/ month</small>
  187. </h3>
  188. </div>
  189. </div>
  190. <div class="col-sm-4">
  191. <div id="plan-business-plus" class="panel plan {% if sub.plan_id == "P80" or sub.plan_id == "Y768" %}selected{% endif %}">
  192. <div class="marker">Selected Plan</div>
  193. <h2>Business Plus</h2>
  194. <ul>
  195. <li>Checks: 1000</li>
  196. <li>Team members: Unlimited</li>
  197. <li>Log entries: 1000</li>
  198. </ul>
  199. <h3>
  200. <span id="business-plus-price"></span>
  201. <small>/ month</small>
  202. </h3>
  203. </div>
  204. </div>
  205. </div>
  206. <div class="row">
  207. <div id="billing-periods" class="col-sm-6">
  208. <p>Billing Period</p>
  209. <label class="radio-container">
  210. <input
  211. id="billing-monthly"
  212. type="radio"
  213. name="billing_period"
  214. value="monthly"
  215. {% if sub.plan_id == "Y192" or sub.plan_id == "Y768" %}{% else %}checked{% endif %}>
  216. <span class="radiomark"></span>
  217. Monthly
  218. </label>
  219. <label class="radio-container">
  220. <input
  221. id="billing-annual"
  222. type="radio"
  223. name="billing_period"
  224. value="annual"
  225. {% if sub.plan_id == "Y192" or sub.plan_id == "Y768" %} checked {% endif %}>
  226. <span class="radiomark"></span>
  227. Annual, 20% off
  228. </label>
  229. </div>
  230. </div>
  231. <div class="text-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 id="change-plan-btn" type="button" class="btn btn-primary" disabled="disabled">
  241. Change Billing Plan
  242. </button>
  243. </div>
  244. </div>
  245. {% else %}
  246. <div class="modal-content">
  247. <div class="modal-header">
  248. <button type="button" class="close" data-dismiss="modal">&times;</button>
  249. <h4>Some details are missing…</h4>
  250. </div>
  251. <div class="modal-body">
  252. {% if not sub.address_id %}
  253. <div id="no-billing-address">
  254. <h4>Country not specified.</h4>
  255. <p>For tax accounting purposes, please specify
  256. your <strong>Country</strong> in the "Billing Details"
  257. section.
  258. </p>
  259. <p>
  260. Optionally, add your
  261. <strong>company name</strong>, <strong>address</strong>
  262. and <strong>VAT ID</strong>
  263. to have them displayed on invoices.
  264. </p>
  265. </div>
  266. {% endif %}
  267. </div>
  268. <div class="modal-footer">
  269. <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
  270. </div>
  271. </div>
  272. {% endif %}
  273. </div>
  274. </div>
  275. <div id="payment-method-modal" class="modal pm-modal">
  276. <div class="modal-dialog">
  277. <div class="modal-content">
  278. <div class="modal-header">
  279. <button type="button" class="close" data-dismiss="modal">&times;</button>
  280. <h4>Payment Method</h4>
  281. </div>
  282. <div class="modal-body">
  283. <div id="dropin"></div>
  284. </div>
  285. <div class="modal-footer">
  286. <button type="button" class="btn btn-default" data-dismiss="modal">
  287. Cancel
  288. </button>
  289. <button id="payment-form-submit" type="button" class="btn btn-primary" disabled>
  290. Confirm Payment Method
  291. </button>
  292. </div>
  293. </div>
  294. </div>
  295. </div>
  296. <div id="billing-address-modal" class="modal">
  297. <div class="modal-dialog">
  298. <form action="{% url 'hc-billing-address' %}" method="post">
  299. {% csrf_token %}
  300. <div class="modal-content">
  301. <div class="modal-header">
  302. <button type="button" class="close" data-dismiss="modal">&times;</button>
  303. <h4>Billing Details</h4>
  304. </div>
  305. <div class="modal-body">
  306. <div class="row">
  307. <div class="col-sm-8">
  308. <div class="form-group">
  309. <label for="company">
  310. Company
  311. </label>
  312. <input
  313. id="company"
  314. name="company"
  315. type="text"
  316. class="form-control" />
  317. </div>
  318. </div>
  319. <div class="col-sm-4">
  320. <div class="form-group">
  321. <label for="extended_address">
  322. VAT ID
  323. </label>
  324. <input
  325. id="extended_address"
  326. name="extended_address"
  327. type="text"
  328. class="form-control" />
  329. </div>
  330. </div>
  331. <div class="col-sm-12">
  332. <div class="form-group">
  333. <label for="company">Street Address</label>
  334. <input
  335. id="street_address"
  336. name="street_address"
  337. type="text"
  338. class="form-control" />
  339. </div>
  340. </div>
  341. <div class="col-sm-6">
  342. <label for="locality">
  343. City
  344. </label>
  345. <div class="form-group">
  346. <input
  347. id="locality"
  348. name="locality"
  349. type="text"
  350. class="form-control" />
  351. </div>
  352. </div>
  353. <div class="col-sm-6">
  354. <div class="form-group">
  355. <label for="region">
  356. State / Region
  357. </label>
  358. <input
  359. id="region"
  360. name="region"
  361. type="text"
  362. class="form-control" />
  363. </div>
  364. </div>
  365. <div class="col-sm-6">
  366. <div class="form-group">
  367. <label for="postal_Code">
  368. Postal Code
  369. </label>
  370. <input
  371. id="postal_code"
  372. name="postal_code"
  373. type="text"
  374. class="form-control" />
  375. </div>
  376. </div>
  377. <div class="col-sm-6">
  378. <div class="form-group">
  379. <label for="country_code_alpha2">
  380. Country
  381. </label>
  382. <select id="country_code_alpha2" class="form-control" name="country_code_alpha2">
  383. {% include "payments/countries.html" %}
  384. </select>
  385. </div>
  386. </div>
  387. </div>
  388. </div>
  389. <div class="modal-footer">
  390. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  391. <button type="submit" class="btn btn-primary">Save</button>
  392. </div>
  393. </div>
  394. </form>
  395. </div>
  396. </div>
  397. <div id="invoice-emailing-modal" class="modal pm-modal">
  398. <div class="modal-dialog">
  399. <form method="post">
  400. {% csrf_token %}
  401. <div class="modal-content">
  402. <div class="modal-header">
  403. <button type="button" class="close" data-dismiss="modal">&times;</button>
  404. <h4>Invoices to Email</h4>
  405. </div>
  406. <div class="modal-body">
  407. <label class="radio-container">
  408. <input
  409. type="radio"
  410. name="send_invoices"
  411. value="0"
  412. {% if not sub.send_invoices %} checked {% endif %}>
  413. <span class="radiomark"></span>
  414. Do not email invoices to me
  415. </label>
  416. <label class="radio-container">
  417. <input
  418. type="radio"
  419. name="send_invoices"
  420. value="1"
  421. {% if sub.send_invoices and not sub.invoice_email %} checked {% endif %}>
  422. <span class="radiomark"></span>
  423. Send invoices to {{ profile.user.email }}
  424. </label>
  425. <label class="radio-container">
  426. <input
  427. type="radio"
  428. name="send_invoices"
  429. value="2"
  430. {% if sub.send_invoices and sub.invoice_email %} checked {% endif %}>
  431. <span class="radiomark"></span>
  432. Send invoices to this email address:
  433. </label>
  434. <input
  435. id="invoice-email"
  436. name="invoice_email"
  437. placeholder="[email protected]"
  438. value="{{ sub.invoice_email }}"
  439. type="email"
  440. class="form-control" />
  441. </div>
  442. <div class="modal-footer">
  443. <button type="button" class="btn btn-default" data-dismiss="modal">
  444. Cancel
  445. </button>
  446. <button type="submit" class="btn btn-primary">
  447. Save Changes
  448. </button>
  449. </div>
  450. </div>
  451. </form>
  452. </div>
  453. </div>
  454. <div id="please-wait-modal" class="modal pm-modal">
  455. <div class="modal-dialog">
  456. <div class="modal-content">
  457. <div class="modal-header">
  458. <h4>Payment Method</h4>
  459. </div>
  460. <div class="modal-body">
  461. Processing, please wait&hellip;
  462. </div>
  463. <div class="modal-footer">
  464. <button type="button" class="btn btn-primary" disabled>
  465. Confirm Payment Method
  466. </button>
  467. </div>
  468. </div>
  469. </div>
  470. </div>
  471. <form id="update-subscription-form" method="post" action="{% url 'hc-update-subscription' %}">
  472. {% csrf_token %}
  473. <input id="nonce" type="hidden" name="nonce" />
  474. <input type="hidden" id="old-plan-id" value="{{ sub.plan_id }}">
  475. <input id="plan-id" type="hidden" name="plan_id" />
  476. </form>
  477. {% endblock %}
  478. {% block scripts %}
  479. <script src="https://js.braintreegateway.com/web/dropin/1.20.0/js/dropin.min.js"></script>
  480. {% compress js %}
  481. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  482. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  483. <script src="{% static 'js/billing.js' %}"></script>
  484. {% endcompress %}
  485. {% endblock %}