overview.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. {% extends "layouts/main.html" %}
  2. {% block title %}{{ user.name }}{% endblock %}
  3. {% block head %}
  4. <link href="{{ url_for('static', filename='vendor/datatables/dataTables.bootstrap4.css') }}" rel="stylesheet">
  5. {% endblock %}
  6. {% block content %}
  7. <div class="card mb-3">
  8. <div class="card-header">
  9. <i class="fa fa-user"></i> Information
  10. {% if current_user.id == user.id %}
  11. <a href="{{ url_for('user_generate_key', id=user.id) }}" class="btn btn-secondary btn-sm pull-right">Genereer key</a>
  12. {% endif %}
  13. </div>
  14. <div class="card-body">
  15. <div class="row mt-2">
  16. <div class="col-4">Name</div>
  17. <div class="col-8">{{ user.name }}</div>
  18. </div>
  19. <div class="row mt-2">
  20. <div class="col-4">Email</div>
  21. <div class="col-8">{{ user.email }}</div>
  22. </div>
  23. <div class="row mt-2">
  24. <div class="col-4">Registration</div>
  25. <div class="col-8">{{ user.registration_at.strftime('%Y-%m-%d %H:%m') }}</div>
  26. </div>
  27. </div>
  28. </div>
  29. <table class="table table-bordered dataTable" cellspacing="0">
  30. <thead>
  31. <tr>
  32. {% if current_user.id == user.id %}
  33. <th></th>
  34. {% endif %}
  35. <th>ID</th>
  36. {% if current_user.id == user.id %}
  37. <th>Key</th>
  38. {% else %}
  39. <th>Active</th>
  40. {% endif %}
  41. <th>Uses</th>
  42. <th>Created</th>
  43. <th>Expire</th>
  44. </tr>
  45. </thead>
  46. <tbody>
  47. {% for key in user.keys %}
  48. <tr>
  49. {% if current_user.id == user.id %}
  50. <td>
  51. <a href="{{ url_for('user_toogle_key', user_id=user.id, key_id=key.id) }}" class="btn btn-{{ 'secondary' if key.active else 'primary' }} btn-sm">{{ "Deactivate" if key.active else "Activate" }}</a>
  52. </td>
  53. {% endif %}
  54. <td>{{ key.id}}</td>
  55. {% if current_user.id == user.id %}
  56. <td>{{ key.key }}</td>
  57. {% else %}
  58. <td>{{ key.active }}</td>
  59. {% endif %}
  60. <td>{{ key.uses }}</td>
  61. <td>{{ key.created_at.strftime('%Y-%m-%d %H:%m') }}</td>
  62. <td>{{ key.expire_at }}</td>
  63. </tr>
  64. {% endfor %}
  65. </tbody>
  66. </table>
  67. {% endblock %}
  68. {% block javascript %}
  69. <script type='text/javascript' src="{{ url_for('static', filename='vendor/datatables/jquery.dataTables.js') }}"></script>
  70. <script type='text/javascript' src="{{ url_for('static', filename='vendor/datatables/dataTables.bootstrap4.js') }}"></script>
  71. <script type='text/javascript' src="{{ url_for('static', filename='js/site/sb-admin-datatables.min.js') }}"></script>
  72. {% endblock %}