92 lines
3.9 KiB
PHP
92 lines
3.9 KiB
PHP
<?= $this->extend('layouts/main') ?>
|
|
|
|
<?= $this->section('content') ?>
|
|
<header class="cb-page-header cb-page-header--center">
|
|
<div>
|
|
<h1 class="cb-page-title">Users</h1>
|
|
<p class="cb-page-subtitle mb-0">Search, filter, and open accounts.</p>
|
|
</div>
|
|
<a class="btn cb-settings-back" href="<?= base_url('admin/settings') ?>">App settings</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">
|
|
<form class="row g-3 align-items-end" method="get" action="<?= base_url('admin/users') ?>">
|
|
<div class="col-12 col-md-6 col-lg-5">
|
|
<label class="form-label" for="users-search">Search</label>
|
|
<input id="users-search" class="form-control" name="search" placeholder="Search by name or email" value="<?= esc($search ?? '') ?>" autocomplete="off">
|
|
</div>
|
|
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
|
|
<label class="form-label" for="users-status">Status</label>
|
|
<select id="users-status" class="form-select" name="status">
|
|
<option value="">All status</option>
|
|
<option value="1" <?= ($status ?? '') === '1' ? 'selected' : '' ?>>Active</option>
|
|
<option value="0" <?= ($status ?? '') === '0' ? 'selected' : '' ?>>Inactive</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-12 col-md-auto align-self-end">
|
|
<button class="btn btn-primary px-4" type="submit">Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="cb-table-shell">
|
|
<div class="table-responsive">
|
|
<table class="table cb-data-table align-middle">
|
|
<thead>
|
|
<tr>
|
|
<th class="text-muted" style="width:4rem;">ID</th>
|
|
<th>Name</th>
|
|
<th>Email</th>
|
|
<th>Role</th>
|
|
<th>Status</th>
|
|
<th class="text-end">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if ($users === []): ?>
|
|
<tr>
|
|
<td colspan="6" class="text-center text-muted py-5">No users match your filters.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
<?php foreach ($users as $user): ?>
|
|
<tr>
|
|
<td class="text-muted small"><?= esc((string) $user['id']) ?></td>
|
|
<td>
|
|
<div class="cb-cell-name"><?= esc($user['name']) ?></div>
|
|
</td>
|
|
<td class="text-muted small"><?= esc($user['email']) ?></td>
|
|
<td>
|
|
<span class="cb-admin-role-pill"><?= esc($user['role']) ?></span>
|
|
</td>
|
|
<td>
|
|
<?php if ((int) $user['is_active'] === 1): ?>
|
|
<span class="cb-badge-connected">Active</span>
|
|
<?php else: ?>
|
|
<span class="badge rounded-pill bg-danger-subtle text-danger">Inactive</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td class="text-end">
|
|
<div class="cb-table-actions">
|
|
<a class="cb-action-btn cb-action-btn--edit" href="<?= base_url('admin/users/edit/' . $user['id']) ?>">Edit</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="cb-pager-wrap">
|
|
<?= $pager->links('default', 'cb_full') ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?= $this->endSection() ?>
|