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.

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