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.

71 lines
2.5 KiB

3 years ago
  1. <!DOCTYPE html>
  2. <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Upload New CSV</title>
  7. <!-- Fonts -->
  8. <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
  9. <link rel="stylesheet" type="text/css" href="{{ asset('css/csv-upload.css') }}">
  10. <script>
  11. document.addEventListener('DOMContentLoaded', function() {
  12. document.getElementById('file-input').onchange = function () {
  13. document.getElementById('file-input-label').textContent = document.getElementById('file-input').files[0].name;
  14. }
  15. }, false);
  16. </script>
  17. </head>
  18. <body class="antialiased">
  19. <div id="demo">
  20. <h1>Upload New CSV</h1>
  21. <h2>CSV parser</h2>
  22. <form action="{{route('fileUpload')}}" method="post" enctype="multipart/form-data">
  23. @csrf
  24. @if (count($errors) > 0)
  25. <div>
  26. <ul>
  27. @foreach ($errors->all() as $error)
  28. <li>{{ $error }}</li>
  29. @endforeach
  30. </ul>
  31. </div>
  32. @endif
  33. <div class="file-uploader">
  34. <label id="file-input-label" for="file-input">Select your file</label>
  35. <input id="file-input" type="file" name="file"/>
  36. </div>
  37. <button type="submit" name="submit">Upload Files</button>
  38. </form>
  39. @if ($results = Session::get('results'))
  40. <h2>Bank Transactions from CSV</h2>
  41. <div class="table-responsive-vertical shadow-z-1">
  42. <table id="table" class="table table-hover table-mc-light-blue">
  43. @foreach ($results as $index => $row)
  44. <tr>
  45. @foreach ($row as $column)
  46. @if ($index === 0)
  47. <th>{{ $column }}</th>
  48. @break
  49. @endif
  50. <td>{{ $column }}</td>
  51. @endforeach
  52. </tr>
  53. @endforeach
  54. <table>
  55. </div>
  56. @endif
  57. </div>
  58. </body>
  59. </html>