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.

544 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.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. {% 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. data-target="#change-billing-plan-modal"
  62. class="btn btn-default pull-right">
  63. Change Billing Plan
  64. </button>
  65. </div>
  66. {% if set_plan_status == "success" %}
  67. <div class="panel-footer">
  68. Your billing plan has been updated!
  69. </div>
  70. {% endif %}
  71. </div>
  72. {% if sub.subscription_id %}
  73. <div class="panel panel-{{ payment_method_status }}">
  74. <div class="panel-body settings-block">
  75. <h2>Payment Method</h2>
  76. <p id="payment-method">
  77. <span class="loading">loading…</span>
  78. </p>
  79. <button
  80. id="update-payment-method"
  81. class="btn btn-default pull-right">
  82. Change Payment Method</button>
  83. </div>
  84. {% if payment_method_status == "success" %}
  85. <div class="panel-footer">
  86. Your payment method has been updated!
  87. </div>
  88. {% endif %}
  89. </div>
  90. {% endif %}
  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.address_id %}
  158. <div class="modal-content">
  159. <div class="modal-header">
  160. <button type="button" class="close" data-dismiss="modal">&times;</button>
  161. <h4>Change Billing Plan</h4>
  162. </div>
  163. <div class="modal-body">
  164. <div class="row">
  165. <div class="col-sm-6 col-md-3">
  166. <div id="plan-hobbyist" class="panel plan {% if sub.plan_id == "" %}selected{% endif %}">
  167. <div class="marker">Selected Plan</div>
  168. <h2>Hobbyist</h2>
  169. <ul>
  170. <li>Checks: 20</li>
  171. <li>Team size: 3</li>
  172. <li>Log entries: 100</li>
  173. </ul>
  174. <h3>Free</h3>
  175. </div>
  176. </div>
  177. <div class="col-sm-6 col-md-3">
  178. <div id="plan-supporter" class="panel plan {% if sub.is_supporter %}selected{% endif %}">
  179. <div class="marker">Selected Plan</div>
  180. <h2>Supporter</h2>
  181. <ul>
  182. <li>Checks: 20</li>
  183. <li>Team size: 3</li>
  184. <li>Log entries: 1000</li>
  185. </ul>
  186. <h3>
  187. <span id="supporter-price"></span>
  188. <small>/ month</small>
  189. </h3>
  190. </div>
  191. </div>
  192. <div class="col-sm-6 col-md-3">
  193. <div id="plan-business" class="panel plan {% if sub.is_business %}selected{% endif %}">
  194. <div class="marker">Selected Plan</div>
  195. <h2>Business</h2>
  196. <ul>
  197. <li>Checks: 100</li>
  198. <li>Team size: 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-6 col-md-3">
  208. <div id="plan-business-plus" class="panel plan {% if sub.is_business_plus %}selected{% endif %}">
  209. <div class="marker">Selected Plan</div>
  210. <h2>Business Plus</h2>
  211. <ul>
  212. <li>Checks: 1000</li>
  213. <li>Team size: Unlim.</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 not sub.is_annual %}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.is_annual %} 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="button" class="btn btn-primary" disabled="disabled">
  258. Change Billing Plan
  259. </button>
  260. </div>
  261. </div>
  262. {% else %}
  263. <div class="modal-content">
  264. <div class="modal-header">
  265. <button type="button" class="close" data-dismiss="modal">&times;</button>
  266. <h4>Some details are missing…</h4>
  267. </div>
  268. <div class="modal-body">
  269. {% if not sub.address_id %}
  270. <div id="no-billing-address">
  271. <h4>Country not specified.</h4>
  272. <p>For tax accounting purposes, please specify
  273. your <strong>Country</strong> in the "Billing Details"
  274. section.
  275. </p>
  276. <p>
  277. Optionally, add your
  278. <strong>company name</strong>, <strong>address</strong>
  279. and <strong>VAT ID</strong>
  280. to have them displayed on invoices.
  281. </p>
  282. </div>
  283. {% endif %}
  284. </div>
  285. <div class="modal-footer">
  286. <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
  287. </div>
  288. </div>
  289. {% endif %}
  290. </div>
  291. </div>
  292. <div id="payment-method-modal" class="modal pm-modal">
  293. <div class="modal-dialog">
  294. <div class="modal-content">
  295. <div class="modal-header">
  296. <button type="button" class="close" data-dismiss="modal">&times;</button>
  297. <h4>Payment Method</h4>
  298. </div>
  299. <div class="modal-body">
  300. <div id="dropin"></div>
  301. </div>
  302. <div class="modal-footer">
  303. <button type="button" class="btn btn-default" data-dismiss="modal">
  304. Cancel
  305. </button>
  306. <button id="payment-form-submit" type="button" class="btn btn-primary" disabled>
  307. Confirm Payment Method
  308. </button>
  309. </div>
  310. </div>
  311. </div>
  312. </div>
  313. <div id="billing-address-modal" class="modal">
  314. <div class="modal-dialog">
  315. <form action="{% url 'hc-billing-address' %}" method="post">
  316. {% csrf_token %}
  317. <div class="modal-content">
  318. <div class="modal-header">
  319. <button type="button" class="close" data-dismiss="modal">&times;</button>
  320. <h4>Billing Details</h4>
  321. </div>
  322. <div class="modal-body">
  323. <div class="row">
  324. <div class="col-sm-8">
  325. <div class="form-group">
  326. <label for="company">
  327. Company
  328. </label>
  329. <input
  330. id="company"
  331. name="company"
  332. type="text"
  333. class="form-control" />
  334. </div>
  335. </div>
  336. <div class="col-sm-4">
  337. <div class="form-group">
  338. <label for="extended_address">
  339. VAT ID
  340. </label>
  341. <input
  342. id="extended_address"
  343. name="extended_address"
  344. type="text"
  345. class="form-control" />
  346. </div>
  347. </div>
  348. <div class="col-sm-12">
  349. <div class="form-group">
  350. <label for="company">Street Address</label>
  351. <input
  352. id="street_address"
  353. name="street_address"
  354. type="text"
  355. class="form-control" />
  356. </div>
  357. </div>
  358. <div class="col-sm-6">
  359. <label for="locality">
  360. City
  361. </label>
  362. <div class="form-group">
  363. <input
  364. id="locality"
  365. name="locality"
  366. type="text"
  367. class="form-control" />
  368. </div>
  369. </div>
  370. <div class="col-sm-6">
  371. <div class="form-group">
  372. <label for="region">
  373. State / Region
  374. </label>
  375. <input
  376. id="region"
  377. name="region"
  378. type="text"
  379. class="form-control" />
  380. </div>
  381. </div>
  382. <div class="col-sm-6">
  383. <div class="form-group">
  384. <label for="postal_Code">
  385. Postal Code
  386. </label>
  387. <input
  388. id="postal_code"
  389. name="postal_code"
  390. type="text"
  391. class="form-control" />
  392. </div>
  393. </div>
  394. <div class="col-sm-6">
  395. <div class="form-group">
  396. <label for="country_code_alpha2">
  397. Country
  398. </label>
  399. <select id="country_code_alpha2" class="form-control" name="country_code_alpha2">
  400. {% include "payments/countries.html" %}
  401. </select>
  402. </div>
  403. </div>
  404. </div>
  405. </div>
  406. <div class="modal-footer">
  407. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  408. <button type="submit" class="btn btn-primary">Save</button>
  409. </div>
  410. </div>
  411. </form>
  412. </div>
  413. </div>
  414. <div id="invoice-emailing-modal" class="modal pm-modal">
  415. <div class="modal-dialog">
  416. <form method="post">
  417. {% csrf_token %}
  418. <div class="modal-content">
  419. <div class="modal-header">
  420. <button type="button" class="close" data-dismiss="modal">&times;</button>
  421. <h4>Invoices to Email</h4>
  422. </div>
  423. <div class="modal-body">
  424. <label class="radio-container">
  425. <input
  426. type="radio"
  427. name="send_invoices"
  428. value="0"
  429. {% if not sub.send_invoices %} checked {% endif %}>
  430. <span class="radiomark"></span>
  431. Do not email invoices to me
  432. </label>
  433. <label class="radio-container">
  434. <input
  435. type="radio"
  436. name="send_invoices"
  437. value="1"
  438. {% if sub.send_invoices and not sub.invoice_email %} checked {% endif %}>
  439. <span class="radiomark"></span>
  440. Send invoices to {{ profile.user.email }}
  441. </label>
  442. <label class="radio-container">
  443. <input
  444. type="radio"
  445. name="send_invoices"
  446. value="2"
  447. {% if sub.send_invoices and sub.invoice_email %} checked {% endif %}>
  448. <span class="radiomark"></span>
  449. Send invoices to this email address:
  450. </label>
  451. <input
  452. id="invoice-email"
  453. name="invoice_email"
  454. placeholder="[email protected]"
  455. value="{{ sub.invoice_email }}"
  456. type="email"
  457. class="form-control" />
  458. </div>
  459. <div class="modal-footer">
  460. <button type="button" class="btn btn-default" data-dismiss="modal">
  461. Cancel
  462. </button>
  463. <button type="submit" class="btn btn-primary">
  464. Save Changes
  465. </button>
  466. </div>
  467. </div>
  468. </form>
  469. </div>
  470. </div>
  471. <div id="please-wait-modal" class="modal pm-modal">
  472. <div class="modal-dialog">
  473. <div class="modal-content">
  474. <div class="modal-header">
  475. <h4>Payment Method</h4>
  476. </div>
  477. <div class="modal-body">
  478. Processing, please wait&hellip;
  479. </div>
  480. <div class="modal-footer">
  481. <button type="button" class="btn btn-primary" disabled>
  482. Confirm Payment Method
  483. </button>
  484. </div>
  485. </div>
  486. </div>
  487. </div>
  488. <form id="update-subscription-form" method="post" action="{% url 'hc-update-subscription' %}">
  489. {% csrf_token %}
  490. <input id="nonce" type="hidden" name="nonce" />
  491. <input type="hidden" id="old-plan-id" value="{{ sub.plan_id }}">
  492. <input id="plan-id" type="hidden" name="plan_id" />
  493. </form>
  494. {% endblock %}
  495. {% block scripts %}
  496. <script src="https://js.braintreegateway.com/web/dropin/1.20.0/js/dropin.min.js"></script>
  497. {% compress js %}
  498. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  499. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  500. <script src="{% static 'js/billing.js' %}"></script>
  501. {% endcompress %}
  502. {% endblock %}