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.

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