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.

552 lines
22 KiB

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