user-group-detail.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. {% extends '../layout/admin.html' %}
  2. {% block html_title %}グループ管理 · {% endblock %}
  3. {% block content_head %}
  4. <div class="header-wrap">
  5. <header id="page-header">
  6. <h1 class="title" id="">グループ管理(グループ詳細)</h1>
  7. </header>
  8. </div>
  9. {% endblock %}
  10. {% block content_main %}
  11. <div class="content-main">
  12. {% set smessage = req.flash('successMessage') %}
  13. {% if smessage.length %}
  14. <div class="alert alert-success">
  15. {{ smessage }}
  16. </div>
  17. {% endif %}
  18. {% set emessage = req.flash('errorMessage') %}
  19. {% if emessage.length %}
  20. <div class="alert alert-danger">
  21. {{ emessage }}
  22. </div>
  23. {% endif %}
  24. <div class="row">
  25. <div class="col-md-3">
  26. {% include './widget/menu.html' with {current: 'user-group'} %}
  27. </div>
  28. <div class="col-md-9">
  29. <a href="/admin/user-groups">
  30. <i class="fa fa-arrow-left"></i> グループ一覧</a>
  31. <div class="modal fade" id="admin-add-user-group-relation-modal">
  32. <div class="modal-dialog">
  33. <div class="modal-content">
  34. <div class="modal-header">
  35. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  36. <h4 class="modal-title">
  37. グループにユーザを追加します</h4>
  38. </div>
  39. <div class="modal-body">
  40. <p>
  41. ユーザ名を入力してください。
  42. </p>
  43. <form class="form-inline" role="form" action="/admin/user-group-relation/create" method="post">
  44. <div class="form-group">
  45. <label for="inputRelatedUserName">Add related user:</label>
  46. <input type="text" name="user_name" class="form-control input-sm" id="inputRelatedUserName" placeholder="username">
  47. </div>
  48. <input type="hidden" name="user_group_id" value="{{userGroup.id}}">
  49. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  50. <button type="submit" class="btn btn-sm btn-danger">実行</button>
  51. </form>
  52. {% if 0 < notRelatedusers.length %}
  53. <hr>
  54. <p>
  55. ユーザ名を選択してください。
  56. </p>
  57. <ul class="list-inline">
  58. {% for sUser in notRelatedusers %}
  59. <li>
  60. <form role="form" action="/admin/user-group-relation/create" method="post">
  61. <!-- <input type="hidden" name="user_name" value="{{sUser.username}}"> -->
  62. <input type="hidden" name="user_group_id" value="{{userGroup.id}}">
  63. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  64. <button type="submit" name="user_name" value="{{sUser.username}}" class="btn btn-xs btn-primary">{{sUser.username}}</button>
  65. </form>
  66. </li>
  67. {% endfor %}
  68. </ul>
  69. {% endif %}
  70. </div>
  71. </div>
  72. <!-- /.modal-content -->
  73. </div>
  74. <!-- /.modal-dialog -->
  75. </div>
  76. <h2>ユーザー一覧</h2>
  77. <table class="table table-hover table-striped table-bordered table-user-list">
  78. <thead>
  79. <tr>
  80. <th width="100px">#</th>
  81. <th>
  82. <code>username</code>
  83. </th>
  84. <th>名前</th>
  85. <th width="100px">作成日</th>
  86. <th width="150px">最終ログイン</th>
  87. <th width="90px">操作</th>
  88. </tr>
  89. </thead>
  90. <tbody>
  91. {% for sRelation in userGroupRelations %}
  92. {% set sUser = sRelation.relatedUser%}
  93. <tr>
  94. <td>
  95. <img src="{{ sRelation.relatedUser|picture }}" class="picture picture-rounded" />
  96. </td>
  97. <td>
  98. <strong>{{ sRelation.relatedUser.username }}</strong>
  99. </td>
  100. <td>{{ sRelation.relatedUser.name }}</td>
  101. <td>{{ sRelation.relatedUser.createdAt|date('Y-m-d', sRelation.relatedUser.createdAt.getTimezoneOffset()) }}</td>
  102. <td>
  103. {% if sRelation.relatedUser.lastLoginAt %} {{ sRelation.relatedUser.lastLoginAt|date('Y-m-d H:i', sRelation.relatedUser.createdAt.getTimezoneOffset()) }} {% endif %}
  104. </td>
  105. <td>
  106. <div class="btn-group admin-user-menu">
  107. <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
  108. 編集
  109. <span class="caret"></span>
  110. </button>
  111. <ul class="dropdown-menu" role="menu">
  112. <li class="dropdown-header">編集メニュー</li>
  113. <li class="divider"></li>
  114. <li class="dropdown-button">
  115. <form action="/admin/user-group-relation/{{userGroup.name}}/remove-relation/{{ sRelation._id.toString() }}" method="post">
  116. <input type="hidden" name="_csrf" value="{{ csrf() }}">
  117. <button type="submit" class="btn btn-block btn-danger">グループから外す</button>
  118. </form>
  119. </li>
  120. </ul>
  121. </div>
  122. </td>
  123. </tr>
  124. {% endfor %}
  125. {% if 0 < notRelatedusers.length %}
  126. <tr>
  127. <td></td>
  128. <td><button type="button" class="btn btn-primary" data-target="#admin-add-user-group-relation-modal" data-toggle="modal"><i class="fa fa-plus"></i></button></td>
  129. <td></td>
  130. <td></td>
  131. <td></td>
  132. <td></td>
  133. </tr>
  134. {% endif %}
  135. </tbody>
  136. </table>
  137. <!-- {% include '../widget/pager.html' with {path: "/admin/user-group-detail", pager: pager} %} -->
  138. </div>
  139. </div>
  140. </div>
  141. {% endblock content_main %}
  142. {% block content_footer %}
  143. {% endblock content_footer %}