person-import.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {% extends "base.html" %}
  2. {% block title %}Import Persons - astro-mcp{% endblock %}
  3. {% block content %}
  4. <h1>Import Persons</h1>
  5. <div class="toolbar">
  6. <a href="/dashboard/persons" class="btn btn-ghost">← Back to Persons</a>
  7. </div>
  8. {% if imported is not none %}
  9. <div class="card">
  10. <h2>Import Results</h2>
  11. <p><strong>{{ imported }}</strong> person(s) imported successfully.</p>
  12. {% if errors %}
  13. <h3 style="color:#f85149;margin-top:1rem">Errors</h3>
  14. <ul style="color:#f85149;padding-left:1.5rem">
  15. {% for err in errors %}
  16. <li>{{ err }}</li>
  17. {% endfor %}
  18. </ul>
  19. {% endif %}
  20. </div>
  21. {% endif %}
  22. <div class="card">
  23. <h2>Upload JSON File</h2>
  24. <p class="form-hint" style="margin-bottom:1rem">
  25. Upload a JSON file containing person data. The file should be either a single person object
  26. or an array of person objects. Each person must have at minimum: <code>name</code>,
  27. <code>birth_datetime</code>, <code>latitude</code>, <code>longitude</code>.
  28. </p>
  29. <form method="post" action="/dashboard/persons/import" enctype="multipart/form-data">
  30. <div class="form-group">
  31. <label for="import_file">JSON File</label>
  32. <input type="file" id="import_file" name="import_file" accept=".json,application/json" required>
  33. </div>
  34. <div class="form-actions">
  35. <button type="submit" class="btn btn-primary">Import</button>
  36. <a href="/dashboard/persons" class="btn btn-ghost">Cancel</a>
  37. </div>
  38. </form>
  39. </div>
  40. <div class="card">
  41. <h2>Expected JSON Format</h2>
  42. <pre style="background:#0d1117;padding:1rem;border-radius:6px;overflow-x:auto;font-size:0.8rem;color:#8b949e"><code>[
  43. {
  44. "name": "John Doe",
  45. "nickname": "john",
  46. "birth_datetime": "1990-05-15T08:30:00+02:00",
  47. "birthplace": "Vienna, Austria",
  48. "latitude": 48.2082,
  49. "longitude": 16.3738,
  50. "elevation": 171,
  51. "alive": true,
  52. "private": false,
  53. "gender": "male",
  54. "description": "A sample person",
  55. "notes": "Some notes here",
  56. "timezone": "Europe/Vienna",
  57. "birth_time_known": true
  58. }
  59. ]</code></pre>
  60. </div>
  61. {% endblock %}