2026-09-30 00:49:53 +08:00
|
|
|
<div class="page-head">
|
|
|
|
|
<h1>家庭名册</h1>
|
|
|
|
|
<span class="sub">共 <?= count($people) ?> 人</span>
|
|
|
|
|
<div class="actions">
|
|
|
|
|
<?php if (\App\Auth::isAdmin()): ?>
|
|
|
|
|
<a class="btn btn-sm" href="<?= e(url('people/new')) ?>">添加成员</a>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<form class="search" method="get" action="index.php">
|
|
|
|
|
<input type="hidden" name="r" value="people">
|
2026-09-30 09:44:55 +08:00
|
|
|
<input class="input" name="q" value="<?= e($q) ?>" placeholder="按姓名、称呼或邮箱搜索">
|
2026-09-30 00:49:53 +08:00
|
|
|
<button class="btn btn-ghost btn-sm" type="submit">搜索</button>
|
|
|
|
|
<?php if ($q !== ''): ?>
|
|
|
|
|
<a class="link-quiet" href="<?= e(url('people')) ?>">清除</a>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<?php if (!$people): ?>
|
|
|
|
|
<div class="empty">
|
|
|
|
|
<b><?= $q !== '' ? '没有匹配的人' : '名册还是空的' ?></b>
|
|
|
|
|
<?= $q !== '' ? '换个词试试。' : '把家里人加进来,之后观影、旅行的同行人就可以直接从名册里选。' ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<div class="people-grid">
|
|
|
|
|
<?php foreach ($people as $p): ?>
|
2026-09-30 09:44:55 +08:00
|
|
|
<?php
|
|
|
|
|
// 显示名走「我怎么称呼他」:同一个孩子,爸爸看到"儿子"、妈妈看到"小宝"。
|
|
|
|
|
// ⚠️ 不要再读 $p['nickname'] —— 那是已废弃的旧列(全家共用一个小名)。
|
|
|
|
|
$pshow = (string)($p['shown'] ?? '');
|
|
|
|
|
if ($pshow === '') {
|
|
|
|
|
$pshow = (string)$p['name'];
|
|
|
|
|
}
|
|
|
|
|
$pNick = (string)($p['my_nickname'] ?? '');
|
|
|
|
|
?>
|
2026-09-30 00:49:53 +08:00
|
|
|
<a class="person" href="<?= e(url('people/show', ['id' => (int)$p['id']])) ?>">
|
2026-09-30 08:13:07 +08:00
|
|
|
<div class="ph"><img src="<?= e(avatar_url($p['avatar'])) ?>" alt=""></div>
|
2026-09-30 00:49:53 +08:00
|
|
|
<div class="pb">
|
2026-09-30 08:13:07 +08:00
|
|
|
<div class="pname">
|
2026-09-30 09:44:55 +08:00
|
|
|
<?= e($pshow) ?>
|
|
|
|
|
<?php if ((int)$p['id'] === (int)$meId): ?><span class="badge badge-me">我</span><?php endif; ?>
|
2026-09-30 08:13:07 +08:00
|
|
|
<?php if (!empty($p['is_placeholder'])): ?><span class="badge">待确认</span><?php endif; ?>
|
|
|
|
|
</div>
|
2026-09-30 00:49:53 +08:00
|
|
|
<div class="pmeta">
|
2026-09-30 08:13:07 +08:00
|
|
|
<?php if (!empty($p['label']) && $p['label'] !== '我'): ?>
|
|
|
|
|
<span class="rel-label"><?= e($p['label']) ?></span>
|
2026-09-30 00:49:53 +08:00
|
|
|
<?php endif; ?>
|
2026-09-30 08:13:07 +08:00
|
|
|
<?php
|
|
|
|
|
$r = $p['account_role'] ?? '';
|
|
|
|
|
if ($r === 'admin' && ($p['account_status'] ?? '') === 'active') {
|
|
|
|
|
echo '<span class="badge badge-admin">管理员</span>';
|
|
|
|
|
} elseif ($r === 'guest') {
|
|
|
|
|
echo '<span class="badge">访客</span>';
|
|
|
|
|
} elseif (!empty($p['account_id'])) {
|
|
|
|
|
echo '<span class="badge badge-open">已开通</span>';
|
|
|
|
|
}
|
2026-09-30 09:44:55 +08:00
|
|
|
// 我叫他别的名字时,把本名再用小字附上,免得自己都认不出这人是谁
|
|
|
|
|
if ($pNick !== '' && $pNick !== (string)$p['name']) {
|
|
|
|
|
echo ' · <span class="muted">' . e((string)$p['name']) . '</span>';
|
|
|
|
|
}
|
2026-09-30 08:13:07 +08:00
|
|
|
?>
|
2026-09-30 00:49:53 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|