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.

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