<?php $pageTitle = 'Manual: Project Manager'; ?>
<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: Project Manager</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="#projekt-erstellen">Create a Project</a></li>
            <li><a href="#mitglieder">Manage Members &amp; Externals</a></li>
            <li><a href="#statuses">Statuses and Labels</a></li>
            <li><a href="#aufgaben">Create and Assign Tasks</a></li>
            <li><a href="#abhaengigkeiten">Predecessors &amp; Dependencies</a></li>
            <li><a href="#ansichten">Kanban, List &amp; Gantt</a></li>
            <li><a href="#benachrichtigungen">Configure Notifications</a></li>
            <li><a href="#archivieren">Archive or Delete a Project</a></li>
        </ol>
    </div>
</div>

<section id="rolle">
    <h2>1. Your Role as Project Manager</h2>
    <p>As a project manager (<em>Owner</em> or <em>Manager</em>) you have full control over a project: you plan tasks, assign them, track progress and coordinate internal and external members.</p>
    <div class="help-info">
        A project can have <strong>multiple owners</strong> – at least one is always required. Owners have full access including deletion and can promote other members to the owner role. Multiple <strong>managers</strong> can manage project settings in parallel. Regular <strong>members</strong> can create and edit tasks but cannot change project settings. <strong>Guests</strong> can only read.
    </div>
</section>

<section id="projekt-erstellen">
    <h2>2. Create a Project</h2>
    <ol>
        <li>Click <strong>Projects</strong> in the navigation and then <strong>New Project</strong>.</li>
        <li>Fill in the form:
            <ul>
                <li><strong>Project name</strong> – required</li>
                <li><strong>Description</strong> – optional</li>
                <li><strong>Colour</strong> – visual identifier in the overview</li>
                <li><strong>Default view</strong> – Kanban, List or Gantt (can be changed at any time)</li>
            </ul>
        </li>
        <li>Click <strong>Create</strong>.</li>
    </ol>
    <p>After creation you are taken directly to the project view. The project is created with four default statuses: <em>Open, In Progress, Review, Done</em>.</p>
</section>

<section id="mitglieder">
    <h2>3. Manage Members &amp; Externals</h2>
    <h3>Add internal members</h3>
    <ol>
        <li>Open the project and click <strong>Members</strong> at the top (or navigate to <em>Project Settings → Members</em>).</li>
        <li>Select a user from the list and assign a role:
            <table class="help-table" style="margin-top:.5rem">
                <tr><td><strong>Owner</strong></td><td>Full access including deletion</td></tr>
                <tr><td><strong>Manager</strong></td><td>Settings, manage members, all tasks</td></tr>
                <tr><td><strong>Member</strong></td><td>Create and edit tasks</td></tr>
                <tr><td><strong>Guest</strong></td><td>Read only</td></tr>
            </table>
        </li>
        <li>Click <strong>Add</strong>.</li>
    </ol>

    <h3>Invite external participants</h3>
    <p>Externals can view and comment on tasks without their own account – they receive a personal access link.</p>
    <ol>
        <li>Go to <em>Members</em> and scroll to the <strong>External Participants</strong> section.</li>
        <li>Enter a name and optionally an email address.</li>
        <li>Click <strong>Add</strong>.</li>
        <li>The system generates a unique link (<code>/ext/…</code>) which is sent by email (if SMTP is configured) or can be copied manually.</li>
    </ol>
    <div class="help-info">
        If you create a placeholder name without an email (<em>dummy assignment</em>), tasks can be assigned internally to that name without creating external access.
    </div>
</section>

<section id="statuses">
    <h2>4. Configure Statuses and Labels</h2>
    <h3>Project statuses</h3>
    <p>Each project has its own statuses which form the columns in the Kanban board. Default: <em>Open, In Progress, Review, Done</em>.</p>
    <p>Under <strong>Project Settings → Statuses</strong> you can:</p>
    <ul>
        <li>Create new statuses (name, colour, position)</li>
        <li>Rename or recolour existing ones</li>
        <li>Reorder via drag &amp; drop</li>
        <li>Mark a status as <em>"done"</em> (triggers notifications)</li>
        <li>Delete statuses (tasks are moved to another status)</li>
    </ul>

    <h3>Labels</h3>
    <p>Labels are colour-coded tags for categorising tasks (e.g. <em>Bug, Feature, Urgent</em>). Create them under <strong>Project Settings → Labels</strong>.</p>
</section>

<section id="aufgaben">
    <h2>5. Create and Assign Tasks</h2>
    <h3>Create a task</h3>
    <ol>
        <li>Click <strong>+ Task</strong> in a Kanban column or the <strong>New Task</strong> button.</li>
        <li>Fill in the form:
            <ul>
                <li><strong>Title</strong> – short, descriptive name</li>
                <li><strong>Description</strong> – detailed information</li>
                <li><strong>Status</strong> – starting phase of the task</li>
                <li><strong>Priority</strong> – Low, Medium, High or Urgent</li>
                <li><strong>Start date / Due date</strong> – for Gantt display and reminders</li>
                <li><strong>Labels</strong> – one or more tags</li>
                <li><strong>Assignments</strong> – internal members or external participants</li>
                <li><strong>Predecessors</strong> – tasks that must be completed first</li>
                <li><strong>Attachments</strong> – files up to 2 MB (JPG, PNG, GIF, WEBP)</li>
            </ul>
        </li>
        <li>Click <strong>Create</strong>.</li>
    </ol>
    <div class="help-info">
        Required fields for a task can be configured individually under <em>Project Settings → Required Fields</em>.
    </div>

    <h3>Edit a task</h3>
    <p>Click on a task card to open the detail view. There you can edit all fields, read and write comments and manage attachments.</p>
</section>

<section id="abhaengigkeiten">
    <h2>6. Predecessors &amp; Dependencies</h2>
    <p>Task dependencies help map the correct sequence. A task with a predecessor can only be meaningfully worked on once the predecessor is complete.</p>
    <ul>
        <li><strong>Set predecessor:</strong> In the task form under <em>Predecessors</em>, select one or more tasks from the project.</li>
        <li><strong>Successors:</strong> Automatically added as successors on the predecessor task.</li>
        <li><strong>Notification:</strong> When a predecessor is marked as done and the corresponding notification is enabled, the assignees of the successor task are automatically informed.</li>
        <li><strong>Gantt visualisation:</strong> Dependencies are shown as connecting lines in the Gantt chart.</li>
    </ul>

    <h3>Auto-Link</h3>
    <p>In the Gantt chart, dependencies can be derived automatically from the schedule. Click <strong>Auto-Link</strong> in the toolbar.</p>
    <p>The function analyses the start and end dates of all tasks and creates links using the following logic:</p>
    <ul>
        <li>A task becomes a predecessor if its end date is on or before the start date of another task.</li>
        <li>The <strong>closest</strong> predecessor is always chosen – not just any earlier task.</li>
        <li>If <strong>multiple tasks run in parallel</strong> and end at the same time, all are added as predecessors of the following task.</li>
        <li>Existing links are not duplicated.</li>
    </ul>
    <div class="help-info">
        Auto-Link adds to existing dependencies – it does not delete any. You can remove individual connecting lines afterwards by clicking on them in the Gantt chart.
    </div>
</section>

<section id="ansichten">
    <h2>7. Kanban, List &amp; Gantt</h2>

    <h3>Kanban Board</h3>
    <p>The most interactive view. Each column corresponds to a status.</p>
    <ul>
        <li>Drag tasks <strong>between columns</strong> via drag &amp; drop → status updates automatically</li>
        <li>Reorder within a column → adjust sequence</li>
        <li>Click a card → detail view</li>
        <li>Cards show: priority, due date, assignee avatars, comment and attachment counts</li>
    </ul>

    <h3>List View</h3>
    <p>Tabular overview of all tasks, ideal for filtering and sorting.</p>
    <ul>
        <li>Filter by: status, priority, assignee, label, free text</li>
        <li>Change status directly via inline dropdown</li>
        <li>Due date editable inline</li>
    </ul>

    <h3>Gantt Chart</h3>
    <p>Timeline view of all tasks on a time axis.</p>
    <ul>
        <li>Shows start and end date as bars</li>
        <li>Dependencies as connecting lines (manually by dragging from the right edge of a task, or automatically via <strong>Auto-Link</strong>)</li>
        <li>Drag or resize bars → date is updated immediately</li>
        <li>Tasks sorted by start date; tasks without a date appear alphabetically at the end</li>
        <li>Ideal for deadline planning and resource overview</li>
    </ul>
</section>

<section id="benachrichtigungen">
    <h2>8. Configure Notifications</h2>
    <p>Under <strong>Project Settings → Email Notifications</strong> you control who is notified and when.</p>
    <table class="help-table">
        <tr>
            <th>Setting</th>
            <th>When is the email sent?</th>
            <th>Recipient</th>
        </tr>
        <tr>
            <td>Notify on assignment</td>
            <td>Task is assigned to a person</td>
            <td>Assigned person</td>
        </tr>
        <tr>
            <td>Reminder 3 days before due date</td>
            <td>3 days before the due date</td>
            <td>Assigned person</td>
        </tr>
        <tr>
            <td>When predecessor is done</td>
            <td>Predecessor task set to "done"</td>
            <td>Assignees of the successor task</td>
        </tr>
        <tr>
            <td>Manager on any activity</td>
            <td>Any action in the project</td>
            <td>Project manager (manager role)</td>
        </tr>
        <tr>
            <td>Manager when task is done</td>
            <td>Task moved to "done" status</td>
            <td>Project manager (manager role)</td>
        </tr>
    </table>
    <div class="help-info">
        Email delivery is set up by the administrator and is active in normal operation.
    </div>
</section>

<section id="archivieren">
    <h2>9. Archive or Delete a Project</h2>
    <h3>Archive</h3>
    <p>An archived project remains readable but no longer appears in the active project list. Under <strong>Project Settings → General</strong> you will find the <strong>Archive</strong> button. Archived projects can be restored at any time.</p>

    <h3>Delete</h3>
    <p>Deleting a project is <strong>irreversible</strong>. All tasks, comments, attachments and activities are permanently deleted. Only administrators can permanently delete projects.</p>
</section>

</div>

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