<!-- Role Edit Modal -->
  <div class="modal-dialog" role="document">
    <?= form_open('admin/RolePermissions/edit_role_modal', ['id' => 'role-edit-form']) ?>
    <input type="hidden" name="id" id="edit-role-id">
    <div class="modal-content card-outline-info">
              <div class="card-header text-white text-center">Edit Role</div>

      <div class="modal-body">
        <div class="form-group">
          <label for="edit-role-name" class="small">Role Name</label>
          <input type="text" name="name" id="edit-role-name" class="form-control" required>
        </div>

        <div class="form-group">
          <label for="edit-role-label" class="small">Label</label>
          <input type="text" name="label" id="edit-role-label" class="form-control" required>
        </div>
        <div class="form-group text-right">
        <button type="submit" class="btn btn-info">Update</button>
      </div>
      </div>
      
    </div>
    <?= form_close(); ?>
  </div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<script>
$(document).ready(function() {
    $('.role-edit-modal').on('click', function() {
        var id = $(this).data('id');
        var name = $(this).data('name');
        var label = $(this).data('label');

        $('#edit-role-id').val(id);
        $('#edit-role-name').val(name);
        $('#edit-role-label').val(label);

        $('#roleEditModal').modal('show');
    });
});
</script>
