<?php $pageTitle = 'Manual: Group Admin'; ?>
<div class="page-header">
    <div class="page-header-left">
        <a href="/help" class="btn btn-ghost btn-sm">
            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>
            Manual
        </a>
        <h1 class="page-title">Manual: Group Admin</h1>
    </div>
</div>

<div class="help-doc">

<div class="help-toc card">
    <div class="card-body">
        <p style="font-weight:600;margin-bottom:.5rem;font-size:.85rem;color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em">Contents</p>
        <ol class="help-toc-list">
            <li><a href="#rolle">Your Role</a></li>
            <li><a href="#uebersicht">Group Overview</a></li>
            <li><a href="#einladen">Invite Users by Email</a></li>
            <li><a href="#erstellen">Create Users Directly</a></li>
            <li><a href="#verwalten">Manage Members</a></li>
            <li><a href="#einladungen">Manage Invitations</a></li>
            <li><a href="#passwort">Reset Password</a></li>
            <li><a href="#sicherheit">Your Security Settings</a></li>
        </ol>
    </div>
</div>

<section id="rolle">
    <h2>1. Your Role as Group Admin</h2>
    <p>As a group admin you manage the members of your group. You can invite users, create them directly, change their role within the group and remove them if needed. You do not have access to system-wide settings (e.g. SMTP, global user management).</p>
    <div class="help-info">
        Your <strong>management page</strong> is accessible via the <em>Group Administration</em> menu item in the navigation or directly at <code>/group/users</code>.
    </div>
</section>

<section id="uebersicht">
    <h2>2. Group Overview</h2>
    <p>On the management page you see all members of your group in a table with the following columns:</p>
    <ul>
        <li><strong>Name</strong> – display name of the user</li>
        <li><strong>Email</strong> – email address (login identifier)</li>
        <li><strong>Group role</strong> – <em>Group Admin</em> or <em>Member</em></li>
        <li><strong>Last login</strong> – when the user last signed in</li>
        <li><strong>Actions</strong> – Edit, Reset password, Remove from group</li>
    </ul>
    <p>If you manage multiple groups, a dropdown for group selection appears at the top.</p>
</section>

<section id="einladen">
    <h2>3. Invite Users by Email</h2>
    <p>The recommended method for adding new members. The invited person sets their own password.</p>
    <ol>
        <li>Scroll to the <strong>Invite</strong> section on the management page.</li>
        <li>Enter the email address of the person you want to invite.</li>
        <li>Select the desired role: <em>Member</em> or <em>Group Admin</em>.</li>
        <li>Click <strong>Invite</strong>.</li>
    </ol>
    <p>The system automatically sends an email with a personal invitation link. This link is <strong>valid for 7 days</strong>. The recipient clicks it, enters a name and password, and is immediately a member.</p>
    <div class="help-info">
        Email delivery is set up by the administrator. If no email arrives, the invitation link is displayed directly and can be shared manually.
    </div>
</section>

<section id="erstellen">
    <h2>4. Create Users Directly</h2>
    <p>Use this option when you want to set up access immediately without waiting for an invitation to be accepted.</p>
    <ol>
        <li>Click <strong>New User</strong> in the top right.</li>
        <li>Fill in the form:
            <ul>
                <li><strong>First &amp; last name</strong> – at least 3 characters</li>
                <li><strong>Email</strong> – must be unique in the system (login identifier)</li>
                <li><strong>Password</strong> – at least 8 characters (share it securely with the user)</li>
                <li><strong>Group role</strong> – Member or Group Admin</li>
            </ul>
        </li>
        <li>Click <strong>Create</strong>.</li>
    </ol>
    <div class="help-warn">
        The password is not shown again after creation. Share it with the user immediately and recommend changing it after the first login.
    </div>
</section>

<section id="verwalten">
    <h2>5. Manage Members</h2>
    <h3>Change role</h3>
    <ol>
        <li>Click <strong>Edit</strong> in the user's table row.</li>
        <li>Select the new role (<em>Member</em> or <em>Group Admin</em>) from the dropdown.</li>
        <li>Click <strong>Save</strong>.</li>
    </ol>
    <div class="help-info">You cannot change your own role.</div>

    <h3>Remove user from group</h3>
    <p>Removing a user from the group revokes their access to group-based projects. Their account remains in the system.</p>
    <ol>
        <li>Click <strong>Remove from group</strong> in the user's table row.</li>
        <li>Confirm the security dialog.</li>
    </ol>
</section>

<section id="einladungen">
    <h2>6. Manage Invitations</h2>
    <p>Below the invite form you can see all <strong>pending invitations</strong> — those that have not yet been accepted and have not expired.</p>
    <ul>
        <li><strong>Email</strong> – who the invitation was sent to</li>
        <li><strong>Role</strong> – assigned group role upon acceptance</li>
        <li><strong>Expires</strong> – expiry date (7 days after sending)</li>
        <li><strong>Revoke</strong> – deletes the invitation immediately</li>
    </ul>
    <p>After expiry or revocation you can invite again.</p>
</section>

<section id="passwort">
    <h2>7. Reset Password</h2>
    <p>If a user has lost access, you can set their password directly.</p>
    <ol>
        <li>Click <strong>PW Reset</strong> in the user's table row.</li>
        <li>Enter a new password (at least 8 characters).</li>
        <li>Click <strong>Reset</strong>.</li>
    </ol>
    <div class="help-warn">Share the new password only via a secure channel.</div>
</section>

<section id="sicherheit">
    <h2>8. Your Security Settings</h2>
    <p>Under <strong>Settings → Security</strong> (<code>/settings/totp</code>) you can secure your account with two-factor authentication:</p>
    <ul>
        <li><strong>Authenticator app (TOTP)</strong> – scan the QR code with an app (e.g. Google Authenticator, Authy). A 6-digit code is required at every login.</li>
        <li><strong>Email code</strong> – a code is sent to your email address at every login (valid for 10 minutes).</li>
    </ul>
    <p>Both methods can be active simultaneously. In that case you choose which method to use at login.</p>
</section>

</div>

<?php include __DIR__ . '/../partials/help-styles.php'; ?>
