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.

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