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.

195 lines
9.7 KiB

4 years ago
4 years ago
4 years ago
4 years ago
2 years ago
4 years ago
2 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
2 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. {% extends "./layout/default" %}
  2. {% block content %}
  3. <div class="container">
  4. <div class="row mt-3">
  5. <div class="col-lg-10 offset-lg-1">
  6. <h1>Firefly III Data Import Tool, v{{ version }}</h1>
  7. </div>
  8. </div>
  9. <div class="row mt-3">
  10. <div class="col-lg-10 offset-lg-1">
  11. <div class="card">
  12. <div class="card-header">
  13. Firefly III Universal Data Import Tool, v{{ version }}
  14. </div>
  15. <div class="card-body">
  16. <p class="card-text">
  17. Welcome! This tool will help you import data into Firefly III.
  18. You can find instructions in the <a href="https://docs.firefly-iii.org/" target="_blank">documentation</a>. Any links
  19. you see to the documentation will open in a <em>new</em> window or tab.
  20. </p>
  21. <p>
  22. To import data, you need to authenticate with Firefly III, and optionally with one of the data sources this importer supports.
  23. </p>
  24. {% if pat %}
  25. <p id="firefly_expl">
  26. You're using a Personal Access Token to <span class="text-info">authenticate</span> to Firefly III.
  27. </p>
  28. {% endif %}
  29. {% if clientIdWithURL %}
  30. <p id="firefly_expl">
  31. You're using a fixed Client ID and a fixed Firefly III URL to <span class="text-info">authenticate</span> to Firefly III.
  32. </p>
  33. {% endif %}
  34. {% if URLonly %}
  35. <p id="firefly_expl">
  36. You're using a Client ID and a fixed Firefly III URL to <span class="text-info">authenticate</span> to Firefly III.
  37. </p>
  38. {% endif %}
  39. {% if flexible %}
  40. <p id="firefly_expl">
  41. You're using a self-submitted Client ID and Firefly III URL to <span class="text-info">authenticate</span> to Firefly III.
  42. </p>
  43. {% endif %}
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="row" style="margin-top:1em;display: none;" id="error_explain">
  49. <div class="col-lg-10 offset-lg-1">
  50. <div class="card">
  51. <div class="card-header">
  52. Configuration / connection error :(
  53. </div>
  54. <div class="card-body">
  55. <p>The importer could not connect to Firefly III.
  56. Please remedy the error below first, and check out the <a
  57. href="https://docs.firefly-iii.org/references/faq/data-importer/general/" target="_blank">
  58. documentation</a> if necessary.</p>
  59. <p id="error_txt" class="text-danger"></p>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <form action="{{ route('index.post') }}/" method="post">
  65. <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
  66. <div class="row" style="margin-top:1em;" id="importers">
  67. <div class="col-lg-10 offset-lg-1">
  68. <div class="row">
  69. <div class="col-lg-4">
  70. <div class="card">
  71. <div class="card-header">
  72. Import a file
  73. </div>
  74. <div class="card-body">
  75. <button class="btn btn-info disabled" value="file" name="flow" disabled="disabled"
  76. id="file_button"><span class="fas fa-cog fa-spin"></span></button>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="col-lg-4">
  81. <div class="card">
  82. <div class="card-header">
  83. Import from GoCardless
  84. </div>
  85. <div class="card-body">
  86. <p id="nordigen_result" style="display: none;"></p>
  87. <button class="btn btn-info disabled" value="nordigen" name="flow" disabled="disabled" id="nordigen_button"><span
  88. class="fas fa-cog fa-spin"></span></button>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="col-lg-4">
  93. <div class="card">
  94. <div class="card-header">
  95. Import from Spectre
  96. </div>
  97. <div class="card-body">
  98. <p id="spectre_result" style="display: none;"></p>
  99. <button class="btn btn-info disabled" value="spectre" name="flow" disabled="disabled" id="spectre_button"><span
  100. class="fas fa-cog fa-spin"></span></button>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </form>
  108. <div class="row" style="margin-top:1em;" id="importers">
  109. <div class="col-lg-10 offset-lg-1">
  110. <div class="card">
  111. <div class="card-header">
  112. Extra information
  113. </div>
  114. <div class="card-body">
  115. <p>
  116. If you change your settings, you may need to press <strong>start over</strong> for the settings to be recognized.
  117. If you are in doubt if the button works: your session identifier is "{{ identifier }}" and should change every time you
  118. press the button{% if not isDocker %},{% else %} or restart the container,{% endif %} but it has to stay the same when you simply refresh the page.
  119. </p>
  120. <p>
  121. <a class="btn btn-danger btn-sm" href="{{ route('flush') }}" data-bs-toggle="tooltip" data-bs-placement="top"
  122. title="This button resets your progress">Start over</a>
  123. </p>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. {% endblock %}
  130. {% block scripts %}
  131. <script type="text/javascript">
  132. var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
  133. var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
  134. return new bootstrap.Tooltip(tooltipTriggerEl)
  135. })
  136. var url = '{{ route('token.validate') }}';
  137. var tokenPageUrl = '{{ route('token.index') }}';
  138. $.getJSON(url).done(function (data) {
  139. if ('OK' === data.result) {
  140. $('#file_button').removeClass('disabled').text('Import file').removeAttr('disabled');
  141. } else {
  142. $('#importers').hide();
  143. $('#error_explain').show();
  144. $('#firefly_expl').hide();
  145. $('#error_txt').text(data.message);
  146. }
  147. }).fail(function () {
  148. $('#importers').hide();
  149. $('#error_explain').show();
  150. $('#firefly_expl').hide();
  151. $('#error_txt').show().text(data.message);
  152. // window.location = tokenPageUrl;
  153. });
  154. // validate Spectre information:
  155. url = '{{ route('validate.spectre') }}';
  156. $.getJSON(url).done(function (data) {
  157. if ('OK' === data.result) {
  158. $('#spectre_result').hide();
  159. $('#spectre_button').removeClass('disabled').text('Import from Spectre').removeAttr('disabled');
  160. }
  161. if ('NODATA' === data.result) {
  162. $('#spectre_button').removeClass('disabled').text('Import from Spectre').removeAttr('disabled');
  163. }
  164. if ('NOK' === data.result) {
  165. $('#spectre_result').show().text('The Spectre / Salt Edge API is configured incorrectly and cannot be used to import data.');
  166. $('#spectre_button').hide();
  167. }
  168. }).fail(function () {
  169. $('#spectre_result').show().text('The Spectre / Salt Edge API is configured incorrectly and cannot be used to import data.');
  170. $('#spectre_button').hide();
  171. });
  172. // validate GoCardless information
  173. url = '{{ route('validate.nordigen') }}';
  174. $.getJSON(url).done(function (data) {
  175. if ('OK' === data.result) {
  176. $('#nordigen_result').hide();
  177. $('#nordigen_button').removeClass('disabled').text('Import from GoCardless').removeAttr('disabled');
  178. }
  179. if ('NODATA' === data.result) {
  180. $('#nordigen_button').removeClass('disabled').text('Import from GoCardless').removeAttr('disabled');
  181. }
  182. }).fail(function () {
  183. $('#nordigen_result').show().text('The GoCardless API is configured incorrectly and cannot be used to import data.');
  184. $('#nordigen_button').hide();
  185. });
  186. </script>
  187. {% endblock %}