chartboard/app/Views/workspace/invite.php
2026-03-30 09:51:33 +05:30

90 lines
3.8 KiB
PHP

<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>
<header class="cb-page-header cb-page-header--center">
<div>
<h1 class="cb-page-title">Workspace Invitations</h1>
<p class="cb-page-subtitle mb-0">Send invites and manage pending links.</p>
</div>
<a class="btn cb-settings-back" href="<?= base_url('workspace/members/' . $workspaceId) ?>">Back to Members</a>
</header>
<div class="cb-page-body">
<?php if (session()->getFlashdata('success')): ?>
<div class="alert alert-success"><?= esc(session()->getFlashdata('success')) ?></div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger"><?= esc(session()->getFlashdata('error')) ?></div>
<?php endif; ?>
<div class="cb-form-shell">
<h2 class="cb-shell-section-title">Send Invitation</h2>
<form method="post" action="<?= base_url('workspace/invite/' . $workspaceId) ?>">
<?= csrf_field() ?>
<div class="row g-3 align-items-end">
<div class="col-12 col-lg-6">
<label class="form-label" for="invite-email">Email</label>
<input id="invite-email" type="email" class="form-control" name="email" placeholder="teammate@example.com" required autocomplete="email">
</div>
<div class="col-12 col-md-6 col-lg-3">
<label class="form-label" for="invite-role">Role</label>
<select id="invite-role" class="form-select" name="role" required>
<option value="admin">Admin</option>
<option value="editor" selected>Editor</option>
<option value="viewer">Viewer</option>
</select>
</div>
<div class="col-12 col-md-6 col-lg-3 d-grid">
<button type="submit" class="btn btn-dark w-100">Invite</button>
</div>
</div>
</form>
</div>
<div class="cb-table-shell">
<div class="cb-table-shell-banner">
<h2 class="cb-shell-section-title">Pending Invitations</h2>
</div>
<div class="table-responsive">
<table class="table cb-data-table align-middle">
<thead>
<tr>
<th>Email</th>
<th>Role</th>
<th>Expires</th>
<th class="text-end">Actions</th>
</tr>
</thead>
<tbody>
<?php if (($invites ?? []) === []): ?>
<tr>
<td colspan="4" class="text-center text-muted py-5">No pending invites.</td>
</tr>
<?php else: ?>
<?php foreach ($invites as $invite): ?>
<tr>
<td>
<div class="cb-cell-name"><?= esc($invite['email']) ?></div>
</td>
<td>
<span class="cb-role-pill"><?= esc($invite['role']) ?></span>
</td>
<td class="text-muted small"><?= esc($invite['expires_at']) ?></td>
<td class="text-end">
<div class="cb-table-actions">
<form method="post" action="<?= base_url('workspace/invite/' . $workspaceId . '/cancel/' . $invite['id']) ?>" class="d-inline" onsubmit="return confirm('Cancel this invitation?');">
<?= csrf_field() ?>
<button type="submit" class="cb-action-btn cb-action-btn--delete">Cancel</button>
</form>
</div>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<?= $this->endSection() ?>