<div class="modal fade" id="modal-add-group-local-role" role="dialog"
     data-keyboard="true">
  <div class="modal-dialog">
    <div class="modal-content">

      <form method="POST" class="form-horizontal"
            action="{{ url_for(".permissions_update", folder_id=folder.id, community_id=folder.community.slug) }}"
            enctype="multipart/form-data">
        {{ csrf.field() }}
        <input type="hidden" name="action" value="add-group-role"/>

        <div class="modal-header">
          <button class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">{{ _("Add a local role for a group") }}</h4>
        </div>

        <div class="modal-body">
          <div class="form-group">
            <label class="control-label"
                   for="group-select">{{ _("Group") }}</label>

            <div class="controls">
              <select data-toggle="select2" id="group-select" name="group">
                {% for group in all_groups %}
                  <option value="{{ group.id }}">{{ group.name }}</option>
                {% endfor %}
              </select>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label"
                   for="role-select-for-group">{{ _("Role") }}</label>

            <div class="controls">
              <select data-toggle="select2" id="role-select-for-group"
                      name="role">
                <option value="reader">{{ _("Reader") }}</option>
                <option value="writer">{{ _("Writer") }}</option>
                <option value="manager">{{ _("Manager") }}</option>
              </select>
            </div>
          </div>

        </div>

        <div class="modal-footer">
          <button data-dismiss="modal"
                  class="btn btn-default">{{ _("Cancel") }}</button>
          <button class="btn btn-primary" type="submit" name="action"
                  value="add-local-role">{{ _("Add local role") }}</button>
        </div>
      </form>
    </div>
  </div>
</div>

<div class="modal fade" id="modal-add-user-local-role" role="dialog"
     data-keyboard="true">
  <div class="modal-dialog">
    <div class="modal-content">

      <form method="POST" class="form-horizontal"
            action="{{ url_for(".permissions_update", folder_id=folder.id, community_id=folder.community.slug) }}"
            enctype="multipart/form-data">
        {{ csrf.field() }}
        <input type="hidden" name="action" value="add-user-role"/>

        <div class="modal-header">
          <button class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">{{ _("Add a local role for a user") }}</h4>
        </div>

        <div class="modal-body">
          <div class="form-group">
            <label class="control-label" for="user-select">User</label>

            <div class="controls">
              <input type="text" id="user-select" name="user"/>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="role-select">Role</label>

            <div class="controls">
              <select data-toggle="select2" id="role-select" name="role">
                <option value="reader">Reader</option>
                <option value="writer">Writer</option>
                <option value="manager">Manager</option>
              </select>
            </div>
          </div>

        </div>

        <div class="modal-footer">
          <button data-dismiss="modal" class="btn btn-default">Cancel</button>
          <button class="btn btn-primary" type="submit" name="action"
                  value="add-local-role">{{ _("Add local role") }}</button>
        </div>
      </form>
    </div>
  </div>
</div>
