85 lines
3.0 KiB
PHP
85 lines
3.0 KiB
PHP
<?php
|
|||
|
|
$memberCount = count($people);
|
||
|
|
$openCount = 0;
|
||
|
|
foreach ($people as $p) { if (!empty($p['account_id'])) { $openCount++; } }
|
||
|
|
?>
|
||
|
|
|
||
|
|
<section class="hero">
|
||
|
|
<img class="hero-logo" src="<?= e(asset('/assets/icons/icon-192.png')) ?>" alt="">
|
||
|
|
<div>
|
||
|
|
<h1><?= e($family['name']) ?></h1>
|
||
|
|
<p class="motto"><?= e($family['motto'] ?: '一本用岁月写成的家谱') ?></p>
|
||
|
|
</div>
|
||
|
|
<div class="hero-stats">
|
||
|
|
<div class="stat"><b><?= (int)$memberCount ?></b><span>位家庭成员</span></div>
|
||
|
|
<div class="stat"><b><?= (int)$openCount ?></b><span>已开通登录</span></div>
|
||
|
|
<div class="stat"><b><?= count($birthdays) ?></b><span>近期生日</span></div>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
|
||
|
|
<?php if ($birthdays): ?>
|
||
|
|
<section class="section">
|
||
|
|
<h2 class="section-title">接下来的日子 <span class="hint">两个月内</span></h2>
|
||
|
|
<div class="bdays">
|
||
|
|
<?php foreach ($birthdays as $b): ?>
|
||
|
|
<div class="bday">
|
||
|
|
<img src="<?= e(\App\Upload::avatarUrl($b['avatar'])) ?>" alt="">
|
||
|
|
<div>
|
||
|
|
<b><?= e($b['name']) ?></b>
|
||
|
|
<div class="d">
|
||
|
|
<?php if ($b['days_left'] === 0): ?>
|
||
|
|
就是今天,生日快乐
|
||
|
|
<?php else: ?>
|
||
|
|
还有 <?= (int)$b['days_left'] ?> 天过生日
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</div>
|
||
|
|
</section>
|
||
|
|
<?php endif; ?>
|
||
|
|
|
||
|
|
<section class="section">
|
||
|
|
<div class="page-head" style="margin-bottom:12px">
|
||
|
|
<h1 style="font-size:15px">家庭成员</h1>
|
||
|
|
<div class="actions">
|
||
|
|
<a class="btn btn-ghost btn-sm" href="<?= e(url('people')) ?>">管理名册</a>
|
||
|
|
<?php if (\App\Auth::isAdmin()): ?>
|
||
|
|
<a class="btn btn-sm" href="<?= e(url('people/new')) ?>">添加成员</a>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php if (!$people): ?>
|
||
|
|
<div class="empty">
|
||
|
|
<b>名册还是空的</b>
|
||
|
|
先把家里人加进来,之后他们就能出现在每一条记录里。
|
||
|
|
</div>
|
||
|
|
<?php else: ?>
|
||
|
|
<div class="people-grid">
|
||
|
|
<?php foreach ($people as $p): ?>
|
||
|
|
<a class="person" href="<?= e(url('people/show', ['id' => (int)$p['id']])) ?>">
|
||
|
|
<div class="ph"><img src="<?= e(\App\Upload::avatarUrl($p['avatar'])) ?>" alt=""></div>
|
||
|
|
<div class="pb">
|
||
|
|
<div class="pname"><?= e($p['name']) ?></div>
|
||
|
|
<div class="pmeta">
|
||
|
|
<?php if ($p['account_role'] === 'admin' && $p['account_status'] === 'active'): ?>
|
||
|
|
<span class="badge badge-admin">管理员</span>
|
||
|
|
<?php elseif (!empty($p['account_id'])): ?>
|
||
|
|
<span class="badge badge-open">已开通</span>
|
||
|
|
<?php else: ?>
|
||
|
|
<span class="badge">未开通</span>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php
|
||
|
|
$age = age_from($p['birthday'] ?? '');
|
||
|
|
if ($age !== null) { echo ' · ' . (int)$age . ' 岁'; }
|
||
|
|
?>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</a>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</div>
|
||
|
|
<?php endif; ?>
|
||
|
|
</section>
|