2026-09-30 00:49:53 +08:00
|
|
|
|
<?php
|
2026-09-30 09:44:55 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 成员表单(新增 / 编辑)。
|
|
|
|
|
|
*
|
|
|
|
|
|
* 三处与早期版本不同的地方:
|
|
|
|
|
|
* · 「小名」没了 —— 称呼是**视角属性**(妈妈叫"明明"、姐姐叫"小弟"),
|
|
|
|
|
|
* 在「成员详情」页里各自设置自己怎么叫,不写在这个人的档案里。
|
2026-10-03 08:18:05 +08:00
|
|
|
|
* · 生日有两种记法:阳历生日与农历生日(证件上那天照常存库,但按用户要求不再显示)。
|
2026-09-30 09:44:55 +08:00
|
|
|
|
* 阳历与农历是同一个人的同一天,所以用「以哪个为准」明确这次填的是哪一个,
|
|
|
|
|
|
* 服务端据此反推另一个 —— 不靠 JS,避免"JS 没跑到就静默存错"。
|
|
|
|
|
|
* · 生日精确到**时分秒**:原生 datetime-local 只有时分、且中文环境会显示成
|
|
|
|
|
|
* 「下午 03:30」,所以用 _datetime.php 的「日期 + 24 小时制时:分:秒」组合控件。
|
|
|
|
|
|
*/
|
2026-09-30 00:49:53 +08:00
|
|
|
|
$isEdit = !empty($person['id']);
|
2026-09-30 08:13:07 +08:00
|
|
|
|
$avatarUrl = avatar_url($person['avatar'] ?? null);
|
2026-09-30 13:24:26 +08:00
|
|
|
|
// 这张表单有**两个入口**(名册/详情页的「编辑资料」、个人设置里的「编辑我的资料」),
|
|
|
|
|
|
// 但只有一套字段。改自己、且不是能写的人(访客)时,只给属于他自己的那些 ——
|
|
|
|
|
|
// 见 index.php 的 people/update(那条分支调 Person::updateSelf)。
|
|
|
|
|
|
$canEditAll = $canEditAll ?? \App\Auth::canWrite();
|
|
|
|
|
|
$isSelf = $isSelf ?? false;
|
2026-09-30 09:44:55 +08:00
|
|
|
|
|
|
|
|
|
|
$bdSource = old('birthday_source', 'solar');
|
|
|
|
|
|
// 库里这列叫 birthday、表单叫 birthday_solar,一律走 solarOf() 取,别直接下标
|
|
|
|
|
|
$solVal = old('birthday_solar', \App\Birthday::pretty(\App\Birthday::solarOf($person ?? [])));
|
|
|
|
|
|
$lunVal = old('birthday_lunar', '');
|
|
|
|
|
|
if ($lunVal === '') {
|
|
|
|
|
|
// 农历控件的值 = 库里存的农历年月日 + 时间
|
|
|
|
|
|
$lv = (string)($person['birthday_lunar'] ?? '');
|
|
|
|
|
|
$lunVal = $lv;
|
|
|
|
|
|
}
|
2026-09-30 15:02:27 +08:00
|
|
|
|
// 补充联系方式(v6 起):新增时是空数组;编辑时是库里解密后的行;
|
|
|
|
|
|
// 校验失败重画时是用户刚提交的那批(连同填错的也要原样带回)。
|
|
|
|
|
|
$contacts = $contacts ?? [];
|
|
|
|
|
|
foreach (['phone', 'email', 'address', 'url'] as $ctKind) {
|
|
|
|
|
|
if (!isset($contacts[$ctKind]) || !is_array($contacts[$ctKind])) {
|
|
|
|
|
|
$contacts[$ctKind] = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$ctEmpty = ['label' => '', 'value' => ''];
|
|
|
|
|
|
$ctTitles = [
|
|
|
|
|
|
'phone' => '补充电话',
|
|
|
|
|
|
'email' => '补充邮箱',
|
|
|
|
|
|
'address' => '其他地址',
|
|
|
|
|
|
'url' => '网址',
|
|
|
|
|
|
];
|
|
|
|
|
|
$ctHints = [
|
|
|
|
|
|
'phone' => '主手机号在「手机号」一栏(开通登录用);这里放工作号、老人机、家里座机等',
|
|
|
|
|
|
'email' => '主邮箱在「邮箱」一栏;这里放其他邮箱',
|
|
|
|
|
|
'address' => '住址在「住址」一栏;这里放单位地址、老家地址等',
|
|
|
|
|
|
'url' => '主页、博客、店铺链接……',
|
|
|
|
|
|
];
|
2026-10-24 04:25:02 +08:00
|
|
|
|
|
|
|
|
|
|
/* ============================================================================
|
|
|
|
|
|
🔴 v82(用户 2026-10-23):「名册,也没有新增成员这个按钮。」
|
|
|
|
|
|
⚠️ 实测确认:名册模块页右上角那颗「添加成员」**一直在**(`<a class="btn btn-sm"
|
|
|
|
|
|
href="people/new">`,可见可点)。用户说的是**首页「联系人」卡片**上没有按钮。
|
|
|
|
|
|
⇒ 这张表单要能像 `movies/form.php` 那样被**别的页面内嵌成弹框**。
|
|
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
|
两个开关(与观影表单同一套命名,别自创一套):
|
|
|
|
|
|
· `$pfModalOnly` 不输出 page-head(本模板被别的页面内嵌时用);
|
|
|
|
|
|
· `$pfModal` 输出弹框壳(`.cal-modal` + 遮罩)。默认:新增态就是弹框。
|
|
|
|
|
|
首页内嵌时由 `templates/home.php` 传 `$fbAddModalAttr = true`,
|
|
|
|
|
|
本模板据此挂 `data-fb-add-modal` / `data-fb-add-close`(通用开关认这两个属性)。
|
|
|
|
|
|
⚠️ **表单契约一个字没改**:字段名 / enctype / action(people/create)全照旧。
|
|
|
|
|
|
============================================================================ */
|
|
|
|
|
|
$pfModalOnly = !empty($pfModalOnly);
|
|
|
|
|
|
$pfModal = isset($pfModal) ? (bool)$pfModal : !$isEdit;
|
|
|
|
|
|
$pfOpen = isset($pfOpen) ? (bool)$pfOpen : ($pfModal && !$pfModalOnly);
|
|
|
|
|
|
$fbAdd = !empty($fbAddModalAttr);
|
2026-09-30 00:49:53 +08:00
|
|
|
|
?>
|
|
|
|
|
|
|
2026-10-24 04:25:02 +08:00
|
|
|
|
<?php /* ---- 弹框壳(只在 $pfModal 时开)-------------------------------------
|
|
|
|
|
|
⚠️ 首屏默认 `hidden`:首页那张弹框点按钮才开(`data-fb-add-open="#pfAddCard"`)。
|
|
|
|
|
|
不要写成"默认打开"——首页会一进来就糊一层遮罩。
|
|
|
|
|
|
⚠️ `role="dialog" aria-modal="true"` 与站内其它浮层一致(观影/日程/任务)。 */ ?>
|
|
|
|
|
|
<?php if ($pfModal): ?>
|
|
|
|
|
|
<div class="cal-modal" id="pfAddCard" role="dialog" aria-modal="true"
|
|
|
|
|
|
aria-label="<?= $isEdit ? '编辑成员' : '添加成员' ?>"
|
|
|
|
|
|
<?= $pfOpen ? '' : 'hidden' ?><?= $fbAdd ? ' data-fb-add-modal' : '' ?>>
|
|
|
|
|
|
<div class="cal-modal-panel pf-panel">
|
|
|
|
|
|
<div class="cal-modal-head">
|
|
|
|
|
|
<b><?= $isEdit ? ($isSelf ? '我的资料' : '编辑成员') : '添加成员' ?></b>
|
|
|
|
|
|
<button type="button" class="cal-modal-x" id="pfAddX"
|
|
|
|
|
|
aria-label="关闭"<?= $fbAdd ? ' data-fb-add-close' : '' ?>>✕</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
<?php /* ⚠️ v82:弹框形态下这个 page-head 必须消失(它就是"整页"的标志物)——
|
|
|
|
|
|
否则表单会连着页头一起塞进浮层,看起来像"整页被塞进一个框里"。
|
|
|
|
|
|
判据用 `$pfModalOnly`(内嵌方给的),不要用 `$pfModal`
|
|
|
|
|
|
—— 编辑态整页时 `$pfModal` 可能是 true 而它**不是**内嵌。 */ ?>
|
|
|
|
|
|
<?php if (!$pfModalOnly): ?>
|
2026-09-30 00:49:53 +08:00
|
|
|
|
<div class="page-head">
|
2026-09-30 13:24:26 +08:00
|
|
|
|
<h1><?= $isEdit ? ($isSelf ? '我的资料' : '编辑成员') : '添加成员' ?></h1>
|
2026-09-30 00:49:53 +08:00
|
|
|
|
<span class="sub"><?= $isEdit ? e($person['name']) : '填姓名就行,其他都可以以后再补' ?></span>
|
2026-10-04 08:56:40 +08:00
|
|
|
|
<?php /* 用户 2026-10-04 第 8 条:编辑资料的页面也要能**回到名册**。
|
|
|
|
|
|
编辑时是从名册点进来的,改完最常做的下一件事就是回名册找下一个人 ——
|
|
|
|
|
|
没有这个按钮就只能靠浏览器后退(而提交保存之后后退会退到旧页面上)。 */ ?>
|
|
|
|
|
|
<div class="actions">
|
|
|
|
|
|
<a class="btn btn-ghost btn-sm" href="<?= e(url('people')) ?>">返回名册</a>
|
|
|
|
|
|
</div>
|
2026-09-30 00:49:53 +08:00
|
|
|
|
</div>
|
2026-10-24 04:25:02 +08:00
|
|
|
|
<?php endif; ?>
|
2026-09-30 00:49:53 +08:00
|
|
|
|
|
|
|
|
|
|
<form method="post" enctype="multipart/form-data"
|
|
|
|
|
|
action="<?= e(url($isEdit ? 'people/update' : 'people/create')) ?>">
|
|
|
|
|
|
<?= csrf_field() ?>
|
|
|
|
|
|
<?php if ($isEdit): ?>
|
|
|
|
|
|
<input type="hidden" name="id" value="<?= (int)$person['id'] ?>">
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
2026-10-15 23:04:25 +08:00
|
|
|
|
<?php /* 🔴🔴 v52(用户 2026-10-15 第 5 条):「是不是这个人?」
|
|
|
|
|
|
新增成员时,若按 姓名 / 手机号 / 身份证号 在家里找到匹配的人,
|
|
|
|
|
|
**就在这张表里问一句** —— 而不是跳到一个单独的确认页。
|
|
|
|
|
|
⚠️ 关键理由:单独一页要把用户刚填的一整张表(含工作经历、补充联系方式
|
|
|
|
|
|
这些**数组字段**)原样回传;漏传任何一类都会**静默丢数据**。
|
|
|
|
|
|
在同一张表里问,字段天然全在。
|
|
|
|
|
|
⚠️ 两个按钮提交的就是**这张表**,靠 `confirm_existing` 的值分流:
|
|
|
|
|
|
1 = 就是这个人(不新建,直接加进我的名册);0 = 不是,另建一条。 */ ?>
|
|
|
|
|
|
<?php if (!empty($confirmHit)): ?>
|
|
|
|
|
|
<?php
|
|
|
|
|
|
$cfWhy = [
|
|
|
|
|
|
'phone' => '手机号一样',
|
|
|
|
|
|
'id_card' => '身份证号一样',
|
|
|
|
|
|
'name' => '姓名一样',
|
|
|
|
|
|
][(string)($confirmWhy ?? 'name')] ?? '信息很像';
|
|
|
|
|
|
$cfPid = (int)($confirmHit['id'] ?? 0);
|
|
|
|
|
|
$cfInMine = \App\PersonRoster::has((int)\App\Auth::familyId(), (int)\App\Auth::personId(), $cfPid);
|
|
|
|
|
|
?>
|
|
|
|
|
|
<div class="card card-pad person-confirm" id="personConfirm">
|
|
|
|
|
|
<h2 class="section-title">
|
|
|
|
|
|
家里已经有这个人了 —— 是他吗?
|
|
|
|
|
|
<span class="hint"><?= e($cfWhy) ?></span>
|
|
|
|
|
|
</h2>
|
|
|
|
|
|
<p class="small muted" style="margin:0 0 12px">
|
|
|
|
|
|
如果是他,直接加进你的名册就行 —— <b>资料共用同一份</b>,不用再录一遍,
|
|
|
|
|
|
以后你们改的也是同一个人。
|
|
|
|
|
|
<br>如果不是(只是重名),点「不是,是另一个人」,我就按你填的当新人建一条。
|
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="person-hit">
|
|
|
|
|
|
<span class="person-hit-av">
|
|
|
|
|
|
<?php if (!empty($confirmHit['avatar'])): ?>
|
|
|
|
|
|
<img src="<?= e(media_url((string)$confirmHit['avatar'])) ?>" alt="">
|
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
|
<span class="avatar-fallback"><?= e(mb_substr((string)($confirmHit['name'] ?? ''), 0, 1, 'UTF-8')) ?></span>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="person-hit-info">
|
|
|
|
|
|
<b><?= e((string)($confirmHit['name'] ?? '')) ?></b>
|
|
|
|
|
|
<?php if (!empty($confirmHit['is_placeholder'])): ?><span class="node-badge">虚拟人物</span><?php endif; ?>
|
|
|
|
|
|
<?php if ($cfInMine): ?><span class="node-badge badge-open">已在你的名册</span><?php endif; ?>
|
|
|
|
|
|
<span class="small muted">
|
|
|
|
|
|
<?php if ((string)($confirmHit['org'] ?? '') !== ''): ?><?= e((string)$confirmHit['org']) ?> · <?php endif; ?>
|
|
|
|
|
|
<?php if ((string)($confirmHit['title'] ?? '') !== ''): ?><?= e((string)$confirmHit['title']) ?><?php endif; ?>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="person-hit-ops">
|
|
|
|
|
|
<a class="btn btn-ghost btn-sm" href="<?= e(url('people/show', ['id' => $cfPid])) ?>"
|
|
|
|
|
|
target="_blank" rel="noopener">先看看他的资料</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="btn-row" style="margin-top:16px">
|
|
|
|
|
|
<button class="btn" type="submit" name="confirm_existing" value="1">就是这个人,加进我的名册</button>
|
|
|
|
|
|
<button class="btn btn-ghost" type="submit" name="confirm_existing" value="0">不是,是另一个人</button>
|
|
|
|
|
|
<input type="hidden" name="existing_id" value="<?= $cfPid ?>">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
2026-09-30 00:49:53 +08:00
|
|
|
|
<div class="card card-pad">
|
|
|
|
|
|
<div class="form-grid">
|
|
|
|
|
|
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
// 裁剪比例不是拍脑袋定的,而是由「这个位置显示成什么形状」决定(见 App\ImageSlot)。
|
|
|
|
|
|
// 前端拿这些 data-* 去生成裁剪框,服务端拿同一个槽位去最终裁切 —— 一处定义、两处使用。
|
|
|
|
|
|
$avSlot = \App\ImageSlot::get('avatar');
|
|
|
|
|
|
?>
|
|
|
|
|
|
<?php /* 用户 2026-10-03 第 6 条:**头像放在表单最前面**,并且**去掉「选择文件」按钮**
|
|
|
|
|
|
—— 直接点那张(默认)头像就是选文件,选完弹裁剪框。
|
|
|
|
|
|
好处:① 省掉一整行"选择文件 + 当前头像"的重复控件;
|
|
|
|
|
|
② 一眼就知道"这里能换头像"(按钮式的 file 控件反而看不出当前长什么样)。 */ ?>
|
|
|
|
|
|
<div class="field full avatar-field">
|
|
|
|
|
|
<label>头像</label>
|
|
|
|
|
|
<div class="avatar-picker">
|
|
|
|
|
|
<img id="avatar-preview" src="<?= e($avatarUrl) ?>" alt=""
|
|
|
|
|
|
title="点击更换头像"
|
2026-10-05 10:58:17 +08:00
|
|
|
|
data-pick-input="#avatar"
|
2026-10-03 19:27:14 +08:00
|
|
|
|
data-has-avatar="<?= trim((string)($person['avatar'] ?? '')) !== '' ? '1' : '0' ?>">
|
2026-10-05 10:58:17 +08:00
|
|
|
|
<?php /* 真正吃文件的 input:视觉上藏起来,由上面的图片代它触发
|
|
|
|
|
|
(app.js 的通用绑定认 data-pick-input,不依赖 for/id 配对)。 */ ?>
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<input class="sr-only" id="avatar" name="avatar" type="file" accept="image/*"
|
|
|
|
|
|
data-crop-ratio="<?= e((string)$avSlot['ratio']) ?>"
|
|
|
|
|
|
data-crop-w="<?= (int)$avSlot['w'] ?>"
|
|
|
|
|
|
data-crop-h="<?= (int)$avSlot['h'] ?>"
|
|
|
|
|
|
data-crop-label="<?= e((string)$avSlot['label']) ?>"
|
|
|
|
|
|
data-crop-hint="<?= e((string)$avSlot['hint']) ?>"
|
|
|
|
|
|
data-crop-preview="#avatar-preview">
|
|
|
|
|
|
<?php /* 用户挑的裁剪框(归一化的,相对原图 0..1);不裁就留空 = 居中裁切 */ ?>
|
|
|
|
|
|
<input type="hidden" name="avatar_crop" value="">
|
|
|
|
|
|
<span class="avatar-hint small muted">
|
|
|
|
|
|
点一下换头像;选完会弹裁剪框。<br>
|
|
|
|
|
|
头像是 1:1 正方形,多大都能传,保存时自动缩成 <?= (int)$avSlot['w'] ?>×<?= (int)$avSlot['h'] ?>。
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-09-30 00:49:53 +08:00
|
|
|
|
<div class="field">
|
2026-10-26 06:45:38 +08:00
|
|
|
|
<label class="is-req" for="name">姓名</label>
|
2026-09-30 00:49:53 +08:00
|
|
|
|
<input class="input" id="name" name="name" value="<?= e(old('name', $person['name'] ?? '')) ?>" required>
|
|
|
|
|
|
<?php if (!empty($errors['name'])): ?><span class="err"><?= e($errors['name']) ?></span><?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
|
|
<label for="gender">性别</label>
|
|
|
|
|
|
<select class="select" id="gender" name="gender">
|
|
|
|
|
|
<?php $g = old('gender', $person['gender'] ?? ''); ?>
|
|
|
|
|
|
<option value="" <?= $g === '' ? 'selected' : '' ?>>不填</option>
|
|
|
|
|
|
<option value="m" <?= $g === 'm' ? 'selected' : '' ?>>男</option>
|
|
|
|
|
|
<option value="f" <?= $g === 'f' ? 'selected' : '' ?>>女</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-09-30 13:24:26 +08:00
|
|
|
|
<?php if ($canEditAll): ?>
|
2026-09-30 08:13:07 +08:00
|
|
|
|
<div class="field">
|
|
|
|
|
|
<label for="birth_rank">家中排行</label>
|
|
|
|
|
|
<input class="input" id="birth_rank" name="birth_rank" type="number" min="1" max="99"
|
|
|
|
|
|
value="<?= e(old('birth_rank', $person['birth_rank'] ?? '')) ?>" placeholder="老大填 1">
|
|
|
|
|
|
<span class="tip">用来认兄弟姐妹的长幼:长子、次女、三弟…</span>
|
|
|
|
|
|
<?php if (!empty($errors['birth_rank'])): ?><span class="err"><?= e($errors['birth_rank']) ?></span><?php endif; ?>
|
|
|
|
|
|
</div>
|
2026-09-30 13:24:26 +08:00
|
|
|
|
<?php endif; ?>
|
2026-09-30 08:13:07 +08:00
|
|
|
|
|
2026-10-02 09:28:07 +08:00
|
|
|
|
<?php /* ⚠️ 这里**没有**「排序号」(已彻底取消,用户原话:「排序号,不要让用户填写」),
|
|
|
|
|
|
名册里的先后靠**拖动卡片**调。
|
2026-10-16 16:51:04 +08:00
|
|
|
|
|
|
|
|
|
|
🔴🔴 v53(用户 2026-10-16 第 4 条):「名册中添加成员时,**不是选择分组,
|
|
|
|
|
|
而是打标签**。现在已经没有分组的概念了,**只有标签的概念**。」
|
|
|
|
|
|
⇒ 原来这里是一个「所属分组」下拉(group_id)。现在改成**标签输入**,
|
|
|
|
|
|
与「编辑成员」页那个 #ptBlock 同一套(候选勾选 + 自由输入,文本框是唯一提交源)。
|
|
|
|
|
|
⚠️ 只在**新增**时出现在这个位置(编辑时上面那个 #ptBlock 已经在管标签了,
|
|
|
|
|
|
同一张表单里出现两块"标签"会让人以为要填两遍)。
|
|
|
|
|
|
⚠️ 分组(person_roster.group_id)**表结构保留不动** —— 名册里还靠它
|
|
|
|
|
|
做"拖动归档"的容器,历史数据也在。只是**新增入口不再要求人选它**。 */ ?>
|
2026-10-02 09:28:07 +08:00
|
|
|
|
<?php if (!$isEdit): ?>
|
2026-10-16 16:51:04 +08:00
|
|
|
|
<div class="field full" id="ptBlock">
|
|
|
|
|
|
<label for="pfTags">标签</label>
|
|
|
|
|
|
<?php if (!empty($tagChoices)): ?>
|
|
|
|
|
|
<div class="pt-picks pf-picks">
|
|
|
|
|
|
<?php foreach ($tagChoices as $tg): ?>
|
|
|
|
|
|
<label class="pt-pick">
|
|
|
|
|
|
<input type="checkbox" value="<?= e((string)$tg) ?>"
|
|
|
|
|
|
<?= in_array((string)$tg, array_map('strval', (array)($myTags ?? [])), true) ? 'checked' : '' ?>>
|
|
|
|
|
|
<span>#<?= e((string)$tg) ?></span>
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<input class="input" id="pfTags" name="tags" maxlength="300"
|
|
|
|
|
|
value="<?= e(implode(' ', (array)($myTags ?? []))) ?>"
|
|
|
|
|
|
placeholder="如:亲戚 球友 同事(用空格分开)" autocomplete="off">
|
|
|
|
|
|
<span class="tip">
|
|
|
|
|
|
一个人可以有多个标签 —— 既是亲戚又是球友,两个都打上就行。<br>
|
|
|
|
|
|
<b>标签是你自己名册里的</b>:你给他打「球友」不会让全家的名册都多出这个词。
|
|
|
|
|
|
</span>
|
2026-10-02 09:28:07 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
2026-09-30 11:06:22 +08:00
|
|
|
|
|
2026-09-30 15:02:27 +08:00
|
|
|
|
<!-- 生日块已挪到表单最底部:大多数情况下生日由身份证号读出、三个都对,
|
|
|
|
|
|
不需要动(用户原话:生日什么的应该放下面)。 -->
|
|
|
|
|
|
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<?php /* 用户 2026-10-03 第 3 条:「编辑资料中,**这个人的**一句话,这个地方去掉,
|
|
|
|
|
|
每个人的一句话,**只能他自己修改**。如果他不修改,就是默认空的。」
|
|
|
|
|
|
→ 所以这一栏**只在改自己时出现**($isSelf):
|
|
|
|
|
|
别人编辑他时看不到、也改不了(那正是用户要"去掉"的场景);
|
|
|
|
|
|
而它确实得有个入口让他自己填,否则"只能他自己修改"就没有落点。
|
|
|
|
|
|
⚠️ 服务端同理:people/update 只在 $isSelf 时读 slogan,
|
|
|
|
|
|
否则"管理员编辑一次就把本人的那句话清空"。 */ ?>
|
|
|
|
|
|
<?php if ($isSelf): ?>
|
2026-09-30 15:02:27 +08:00
|
|
|
|
<div class="field full">
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<label for="slogan">我的这一句话</label>
|
2026-09-30 15:02:27 +08:00
|
|
|
|
<input class="input" id="slogan" name="slogan" maxlength="200"
|
|
|
|
|
|
value="<?= e(old('slogan', $person['slogan'] ?? '')) ?>"
|
2026-10-03 19:27:14 +08:00
|
|
|
|
placeholder="可留空,如:慢慢来,比较快">
|
|
|
|
|
|
<span class="tip">只有你自己能改这句;显示在自己首页标题下面。留空就不显示。</span>
|
2026-09-30 15:02:27 +08:00
|
|
|
|
<?php if (!empty($errors['slogan'])): ?><span class="err"><?= e($errors['slogan']) ?></span><?php endif; ?>
|
|
|
|
|
|
</div>
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<?php endif; ?>
|
2026-09-30 15:02:27 +08:00
|
|
|
|
|
|
|
|
|
|
<?php if ($canEditAll): ?>
|
|
|
|
|
|
<div class="field">
|
|
|
|
|
|
<label for="phone">手机号</label>
|
|
|
|
|
|
<input class="input" id="phone" name="phone" inputmode="numeric"
|
|
|
|
|
|
value="<?= e(old('phone', $phoneValue ?? '')) ?>" placeholder="可留空">
|
|
|
|
|
|
<span class="tip">开通登录后用它登录;加密存储,列表里只显示部分。其他号码放下面的「补充电话」。</span>
|
|
|
|
|
|
<?php if (!empty($errors['phone'])): ?><span class="err"><?= e($errors['phone']) ?></span><?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
|
|
<label for="email">邮箱</label>
|
|
|
|
|
|
<input class="input" id="email" name="email" type="email"
|
|
|
|
|
|
value="<?= e(old('email', $person['email'] ?? '')) ?>" placeholder="可留空">
|
|
|
|
|
|
<?php if (!empty($errors['email'])): ?><span class="err"><?= e($errors['email']) ?></span><?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<?php /* 用户 2026-10-03 第 4 条:单位/职务/职称**可以有多段**(记录工作变化)。
|
|
|
|
|
|
所以这里是一组"经历行",而不是三个单值输入框。
|
|
|
|
|
|
⚠️ 表单字段名是平行数组(job_org[] / job_title[] …),
|
|
|
|
|
|
服务端 read_jobs_input() + PersonJob::replace() 整组替换。 */ ?>
|
|
|
|
|
|
<div class="field full">
|
|
|
|
|
|
<label>工作经历</label>
|
|
|
|
|
|
<p class="small muted" style="margin:0 0 10px">
|
|
|
|
|
|
一个人可以有多段工作 —— 换过单位、提过职称都记下来。
|
|
|
|
|
|
<b>不填「结束年月」= 现在还在那儿</b>(列表里会标「现在」)。
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<?php
|
|
|
|
|
|
// 回填优先级:老表单回显(old) → 库里已有的经历 → 完全空(新增时给一行空的)
|
|
|
|
|
|
$jobRows = $jobRows ?? [];
|
|
|
|
|
|
if (!$jobRows) {
|
|
|
|
|
|
$jobRows = [[]]; // 新增时给一行空白行,省得还要点"加一段"
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
|
|
<div class="job-list" id="jobList">
|
|
|
|
|
|
<?php foreach ($jobRows as $jr): ?>
|
|
|
|
|
|
<div class="job-row">
|
|
|
|
|
|
<div class="job-cell">
|
|
|
|
|
|
<label class="job-lb">单位</label>
|
|
|
|
|
|
<input class="input" name="job_org[]" value="<?= e((string)($jr['org'] ?? '')) ?>" placeholder="如:中国海洋大学">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="job-cell">
|
|
|
|
|
|
<label class="job-lb">职务</label>
|
|
|
|
|
|
<input class="input" name="job_title[]" value="<?= e((string)($jr['title'] ?? '')) ?>" placeholder="如:副院长">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="job-cell">
|
|
|
|
|
|
<label class="job-lb">职称</label>
|
|
|
|
|
|
<input class="input" name="job_rank[]" value="<?= e((string)($jr['rank_name'] ?? '')) ?>" placeholder="如:副教授">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="job-cell job-cell-sm">
|
|
|
|
|
|
<label class="job-lb">起</label>
|
|
|
|
|
|
<input class="input" type="month" name="job_start[]" value="<?= e((string)($jr['start_ym'] ?? '')) ?>">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="job-cell job-cell-sm">
|
|
|
|
|
|
<label class="job-lb">止</label>
|
|
|
|
|
|
<input class="input" type="month" name="job_end[]" value="<?= e((string)($jr['end_ym'] ?? '')) ?>">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<button type="button" class="btn btn-ghost btn-sm job-del" title="删掉这一段">×</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="btn-row" style="margin-top:8px">
|
|
|
|
|
|
<button type="button" class="btn btn-ghost btn-sm" id="jobAdd">+ 再加一段</button>
|
|
|
|
|
|
</div>
|
2026-09-30 15:02:27 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<?php if ($canEditAll): ?>
|
|
|
|
|
|
<div class="field full">
|
|
|
|
|
|
<label for="id_card">身份证号</label>
|
|
|
|
|
|
<input class="input mono" id="id_card" name="id_card"
|
|
|
|
|
|
value="<?= e(old('id_card', $idCardValue ?? '')) ?>" placeholder="可留空">
|
|
|
|
|
|
<span class="tip">
|
|
|
|
|
|
加密存储,页面上一律只显示前 6 后 4 位。
|
2026-10-03 08:18:05 +08:00
|
|
|
|
家庭场景里真正需要它的场合很少 —— 能不填就别填。
|
2026-09-30 15:02:27 +08:00
|
|
|
|
</span>
|
|
|
|
|
|
<?php if (!empty($errors['id_card'])): ?><span class="err"><?= e($errors['id_card']) ?></span><?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
2026-10-04 08:56:40 +08:00
|
|
|
|
<?php /* 用户 2026-10-04 第 4 条:地址拆成**国家 / 省 / 市 / 区 / 详细地址**五级。
|
|
|
|
|
|
前四级是级联下拉(数据在 regions 表里,全国 3429 条),
|
|
|
|
|
|
最后一级 `address` 就是原来的自由文本 —— 没那么详细时**只填到区**即可,
|
|
|
|
|
|
四个下拉里没选的那些存 NULL,不会留下一堆空串。
|
|
|
|
|
|
⚠️ 没有 JS 也能用:省/市/区三个下拉在服务端就把**当前这一条链**的选项渲染好了,
|
|
|
|
|
|
JS 只负责"换了省就把市和区跟着换"(见 assets/js/app.js 的 addr 段)。 */ ?>
|
2026-09-30 15:02:27 +08:00
|
|
|
|
<div class="field full">
|
2026-10-04 08:56:40 +08:00
|
|
|
|
<label for="addr_province">住址</label>
|
|
|
|
|
|
<div class="addr-grid" data-addr
|
|
|
|
|
|
data-src="<?= e(url('regions')) ?>">
|
|
|
|
|
|
<span class="addr-cell">
|
|
|
|
|
|
<span class="addr-k">国家</span>
|
|
|
|
|
|
<input class="input" id="addr_country" name="addr_country"
|
|
|
|
|
|
value="<?= e(old('addr_country', $person['addr_country'] ?? '')) ?>"
|
|
|
|
|
|
placeholder="中国" autocomplete="country-name">
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="addr-cell">
|
|
|
|
|
|
<span class="addr-k">省 / 自治区</span>
|
|
|
|
|
|
<select class="select" id="addr_province" name="addr_province" data-addr-lvl="1">
|
|
|
|
|
|
<option value="">(不填)</option>
|
|
|
|
|
|
<?php foreach (\App\Region::provinces() as $rg): ?>
|
|
|
|
|
|
<option value="<?= e($rg['name']) ?>" data-code="<?= e($rg['code']) ?>"
|
|
|
|
|
|
<?= old('addr_province', $person['addr_province'] ?? '') === $rg['name'] ? 'selected' : '' ?>>
|
|
|
|
|
|
<?= e($rg['name']) ?></option>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="addr-cell">
|
|
|
|
|
|
<span class="addr-k">市</span>
|
|
|
|
|
|
<?php $cityCode = \App\Region::codeOfName(old('addr_province', $person['addr_province'] ?? ''), 1); ?>
|
|
|
|
|
|
<select class="select" id="addr_city" name="addr_city" data-addr-lvl="2"
|
|
|
|
|
|
data-code="<?= e($cityCode) ?>">
|
|
|
|
|
|
<option value="">(不填)</option>
|
|
|
|
|
|
<?php foreach (\App\Region::childrenOf($cityCode) as $rg): ?>
|
|
|
|
|
|
<option value="<?= e($rg['name']) ?>" data-code="<?= e($rg['code']) ?>"
|
|
|
|
|
|
<?= old('addr_city', $person['addr_city'] ?? '') === $rg['name'] ? 'selected' : '' ?>>
|
|
|
|
|
|
<?= e($rg['name']) ?></option>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="addr-cell">
|
|
|
|
|
|
<span class="addr-k">区 / 县</span>
|
|
|
|
|
|
<?php $distCode = \App\Region::codeOfName(old('addr_city', $person['addr_city'] ?? ''), 2); ?>
|
|
|
|
|
|
<select class="select" id="addr_district" name="addr_district" data-addr-lvl="3"
|
|
|
|
|
|
data-code="<?= e($distCode) ?>">
|
|
|
|
|
|
<option value="">(不填)</option>
|
|
|
|
|
|
<?php foreach (\App\Region::childrenOf($distCode) as $rg): ?>
|
|
|
|
|
|
<option value="<?= e($rg['name']) ?>"
|
|
|
|
|
|
<?= old('addr_district', $person['addr_district'] ?? '') === $rg['name'] ? 'selected' : '' ?>>
|
|
|
|
|
|
<?= e($rg['name']) ?></option>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span class="addr-cell addr-cell-wide">
|
|
|
|
|
|
<span class="addr-k">详细地址</span>
|
|
|
|
|
|
<input class="input" id="address" name="address"
|
|
|
|
|
|
value="<?= e(old('address', $person['address'] ?? '')) ?>"
|
|
|
|
|
|
placeholder="街道门牌、小区楼号……没有就留空" autocomplete="street-address">
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span class="tip">
|
|
|
|
|
|
没有详细地址时只填到「区 / 县」就行 —— 四级里没选的那些不会显示。
|
|
|
|
|
|
</span>
|
2026-09-30 15:02:27 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<?php /* 用户 2026-10-03 第 5 条:备注分两种 ——
|
|
|
|
|
|
① 这一栏是**这个人自己的**自我介绍/格言(他本人也能在个人设置里改,
|
|
|
|
|
|
别人打开他的资料能看到);
|
|
|
|
|
|
② 「我对他的私人备注」在下面单独一块(只有写的人自己看得到)。 */ ?>
|
2026-09-30 15:02:27 +08:00
|
|
|
|
<div class="field full">
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<label for="note">自我介绍(他自己写的)</label>
|
2026-09-30 15:02:27 +08:00
|
|
|
|
<textarea class="input" id="note" name="note" placeholder="爱吃辣、对芒果过敏、怕坐过山车……"><?= e(old('note', $person['note'] ?? '')) ?></textarea>
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<span class="tip">这是<b>他本人</b>的自我介绍,别人看得到。改的是同一份 —— 他也能在个人设置里改。</span>
|
2026-09-30 15:02:27 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<?php /* 用户第 5 条:**我对他的私人备注** —— 只有我自己看得到(存在 person_notes 里)。
|
|
|
|
|
|
只在"编辑别人"时出现(自己看自己不需要"我对我的备注")。
|
|
|
|
|
|
⚠️ 它是独立的出口(自己的路由 + 自己的表),不与上面那份混在一起:
|
2026-10-16 16:51:04 +08:00
|
|
|
|
「他愿意公开说的」与「我对他的私下记录」是两件事、两种可见性。
|
|
|
|
|
|
|
|
|
|
|
|
🔴🔴 v53(用户 2026-10-16 第 5 条):「我在添加一个成员的时候,是不是可以
|
|
|
|
|
|
直接在添加成员的页面里填写**我对他的称呼**以及**我对他的备注**,
|
|
|
|
|
|
**一次就解决**?要不然的话,我还得先添加,然后再返回这个人的名册,
|
|
|
|
|
|
再去填写我对他的备注和称呼。这样其实有点麻烦。」
|
|
|
|
|
|
⇒ 「新增」时也要出现(原来只在"编辑别人"时才有)——
|
|
|
|
|
|
与下面的「我对他的称呼」一起,新增页一次填完。 */ ?>
|
|
|
|
|
|
<?php if (!$isSelf): ?>
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<div class="field full">
|
2026-10-16 16:51:04 +08:00
|
|
|
|
<label for="myNote">我对 <?= $isEdit ? e((string)$person['name']) : '他' ?> 的备注(只有我自己看得到)</label>
|
2026-10-03 19:27:14 +08:00
|
|
|
|
<textarea class="input" id="myNote" name="my_note" rows="2"
|
|
|
|
|
|
placeholder="怎么认识的、要注意什么、上次见面聊了什么……"><?= e((string)($myNote ?? '')) ?></textarea>
|
|
|
|
|
|
<span class="tip">
|
|
|
|
|
|
<b>只有你自己看得到</b>,别人(包括他本人)都看不到 ——
|
|
|
|
|
|
这里写的是"我和他之间的事",不是他的公开资料。
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
2026-10-16 16:51:04 +08:00
|
|
|
|
<?php /* 🔴 v53(用户 2026-10-16 第 5 条):**我对他的称呼**。
|
|
|
|
|
|
称呼是**视角属性**(妈妈叫"明明"、姐姐叫"小弟"),存在 nicknames 表里、
|
|
|
|
|
|
按 (看的人, 被看的人) 一对一条 —— 所以它天然是"我的"称呼,不会改到别人。
|
|
|
|
|
|
⚠️ 与上面「我对他的备注」并排放在一起:用户把这两件事当成"添加时一次填完"
|
|
|
|
|
|
的一组(他原话把「称呼」和「备注」并列)。
|
|
|
|
|
|
⚠️ 新增时也给(此时 $person 还不存在,标题用"他")。 */ ?>
|
|
|
|
|
|
<?php if (!$isSelf): ?>
|
|
|
|
|
|
<div class="field full">
|
|
|
|
|
|
<label for="pfNick">我对 <?= $isEdit ? e((string)$person['name']) : '他' ?> 的称呼</label>
|
|
|
|
|
|
<input class="input" id="pfNick" name="my_nick" maxlength="40"
|
|
|
|
|
|
value="<?= e(old('my_nick', (string)($myNick ?? ''))) ?>"
|
|
|
|
|
|
placeholder="如:大哥、明明、王老师(只有我自己看到)" autocomplete="off">
|
|
|
|
|
|
<span class="tip">
|
|
|
|
|
|
你在他名册里看到的名字会变成这个称呼 —— 妈妈叫「明明」、姐姐叫「小弟」互不影响。<br>
|
|
|
|
|
|
留空就用他自己的名字。
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
2026-10-15 10:37:07 +08:00
|
|
|
|
<?php /* 🔴🔴 v51(用户 2026-10-15 第 4 条):「名册这个功能里面,当我编辑资料的时候,
|
|
|
|
|
|
在这个页面竟然**没有办法选择它的标签**。按道理讲,名册编辑成员这个地方
|
|
|
|
|
|
应该能编辑这一个人的**所有信息**才对。」
|
|
|
|
|
|
⇒ 这一页补上「标签」—— 与名册列表上那颗标签按钮**同一份数据**(person_tags,
|
|
|
|
|
|
owner = 我),在这里改完名册列表上那颗按钮的文字也会跟着变(同一份记录)。
|
|
|
|
|
|
|
|
|
|
|
|
⚠️ 只在**编辑别人**时出现(`$isEdit && !$isSelf`):
|
|
|
|
|
|
标签是"我给别人打的",给自己打没有意义 —— 名册列表那颗标签按钮
|
|
|
|
|
|
本来也只对"我名册里的别人"出现。
|
|
|
|
|
|
⚠️ 与服务端 people/update 的分工:提交上来的 `tags` 由
|
|
|
|
|
|
`PersonTag::setFor(家庭, 我, 这个人, ...)` 整组替换 ——
|
|
|
|
|
|
**owner 永远是"我"**,所以改标签绝不会影响全家的标签。
|
|
|
|
|
|
那一句在 people/update 里(见 index.php 对应分支的注释),
|
|
|
|
|
|
这里只是把输入送到。 */ ?>
|
|
|
|
|
|
<?php if ($isEdit && !$isSelf): ?>
|
|
|
|
|
|
<div class="field full" id="ptBlock">
|
|
|
|
|
|
<label for="pfTags">标签</label>
|
|
|
|
|
|
<?php if (!empty($tagChoices)): ?>
|
|
|
|
|
|
<div class="pt-picks pf-picks">
|
|
|
|
|
|
<?php foreach ($tagChoices as $tg): ?>
|
|
|
|
|
|
<label class="pt-pick">
|
|
|
|
|
|
<input type="checkbox" value="<?= e((string)$tg) ?>"
|
|
|
|
|
|
<?= in_array((string)$tg, array_map('strval', (array)($myTags ?? [])), true) ? 'checked' : '' ?>>
|
|
|
|
|
|
<span>#<?= e((string)$tg) ?></span>
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php /* ⚠️ 文本框是**唯一提交源**(`name="tags"`),勾选框只是快捷方式 ——
|
|
|
|
|
|
与名册列表那个浮层同一套约定(勾/取消会同步进文本框)。
|
|
|
|
|
|
这样服务端只读一个字段,不用担心"勾了又删掉"的边界。 */ ?>
|
|
|
|
|
|
<input class="input" id="pfTags" name="tags" maxlength="300"
|
|
|
|
|
|
value="<?= e(implode(' ', (array)($myTags ?? []))) ?>"
|
|
|
|
|
|
placeholder="如:小学同学 初中同学 球友(用空格分开)" autocomplete="off">
|
|
|
|
|
|
<span class="tip">
|
|
|
|
|
|
一个人可以有多个标签 —— 他既是小学同学、又是初中同学,两个都打上就行。<br>
|
|
|
|
|
|
<b>标签是你自己名册里的</b>:你给他打「球友」不会让全家的名册都多出这个词。
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
2026-09-30 15:02:27 +08:00
|
|
|
|
<!-- ==================== 补充联系方式(可多条,对齐 vCard) ==================== -->
|
|
|
|
|
|
<?php foreach (['phone', 'email', 'address', 'url'] as $ctKind): ?>
|
|
|
|
|
|
<div class="field full ct-block" data-ct-kind="<?= $ctKind ?>">
|
|
|
|
|
|
<label><?= $ctTitles[$ctKind] ?></label>
|
|
|
|
|
|
<p class="small muted" style="margin:0 0 8px"><?= $ctHints[$ctKind] ?></p>
|
|
|
|
|
|
<?php foreach (array_merge($contacts[$ctKind], [$ctEmpty]) as $ctRow): ?>
|
|
|
|
|
|
<div class="ct-row" data-ct-row>
|
|
|
|
|
|
<input class="input ct-label" name="ct_<?= $ctKind ?>_label[]" maxlength="20"
|
|
|
|
|
|
value="<?= e((string)($ctRow['label'] ?? '')) ?>" placeholder="标注(如:工作)">
|
|
|
|
|
|
<input class="input" name="ct_<?= $ctKind ?>_value[]"
|
|
|
|
|
|
value="<?= e((string)($ctRow['value'] ?? '')) ?>"
|
|
|
|
|
|
placeholder="<?= $ctKind === 'phone' ? '号码' : ($ctKind === 'url' ? 'https://…' : '内容') ?>">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
<button type="button" class="btn btn-ghost btn-sm ct-add">再加一个</button>
|
|
|
|
|
|
<?php if (!empty($errors['contacts'])): ?><span class="err"><?= e($errors['contacts']) ?></span><?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- ==================== 三个生日(放在最后:多数情况不用动) ==================== -->
|
2026-09-30 09:44:55 +08:00
|
|
|
|
<div class="field full">
|
|
|
|
|
|
<label>生日</label>
|
|
|
|
|
|
<p class="small muted" style="margin:0 0 12px">
|
2026-10-03 08:18:05 +08:00
|
|
|
|
一个人的生日分两种记法:<b>真实阳历生日</b>与<b>农历生日</b>。
|
|
|
|
|
|
阳历与农历只要填一个,另一个自动算出来。两个不在同一天时,首页会分别提醒。
|
2026-09-30 09:44:55 +08:00
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="bd-source">
|
|
|
|
|
|
<label for="bdSource">我这次填的是</label>
|
|
|
|
|
|
<select class="select" id="bdSource" name="birthday_source" style="width:auto">
|
|
|
|
|
|
<option value="solar" <?= $bdSource === 'solar' ? 'selected' : '' ?>>阳历(公历)</option>
|
|
|
|
|
|
<option value="lunar" <?= $bdSource === 'lunar' ? 'selected' : '' ?>>农历(阴历)</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<span class="small muted">选中的那一边为准,另一边自动算</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="bd-pane" id="bdSolarWrap">
|
|
|
|
|
|
<p class="bd-pane-k">阳历生日</p>
|
|
|
|
|
|
<?php
|
|
|
|
|
|
$dtName = 'birthday_solar';
|
|
|
|
|
|
$dtValue = $solVal;
|
|
|
|
|
|
$dtId = 'birthday_solar_date';
|
|
|
|
|
|
$dtRequired = false;
|
|
|
|
|
|
require __DIR__ . '/../_datetime.php';
|
|
|
|
|
|
?>
|
|
|
|
|
|
<span class="tip">精确到时分秒。不填时分秒就按 00:00:00 记。</span>
|
|
|
|
|
|
<?php if (!empty($errors['birthday_solar'])): ?><span class="err"><?= e($errors['birthday_solar']) ?></span><?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="bd-pane" id="bdLunarWrap">
|
|
|
|
|
|
<p class="bd-pane-k">农历生日</p>
|
|
|
|
|
|
<?php
|
|
|
|
|
|
$dtName = 'birthday_lunar';
|
|
|
|
|
|
$dtValue = $lunVal;
|
|
|
|
|
|
$dtId = 'birthday_lunar_date';
|
|
|
|
|
|
$dtRequired = false;
|
|
|
|
|
|
require __DIR__ . '/../_datetime.php';
|
|
|
|
|
|
?>
|
|
|
|
|
|
<label class="check-item" style="margin-top:8px">
|
|
|
|
|
|
<input type="checkbox" name="birthday_lunar_leap" value="1"
|
|
|
|
|
|
<?= old('birthday_lunar_leap', $person['birthday_lunar_leap'] ?? 0) ? 'checked' : '' ?>>
|
|
|
|
|
|
<span>这个月是<b>闰月</b>(如「闰六月」)</span>
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<?php if (!empty($errors['birthday_lunar'])): ?><span class="err"><?= e($errors['birthday_lunar']) ?></span><?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-09-30 13:24:26 +08:00
|
|
|
|
<?php if ($canEditAll): ?>
|
2026-09-30 08:13:07 +08:00
|
|
|
|
<div class="field full">
|
|
|
|
|
|
<label class="check-item">
|
|
|
|
|
|
<input type="checkbox" name="is_placeholder" value="1"
|
|
|
|
|
|
<?= old('is_placeholder', $person['is_placeholder'] ?? 0) ? 'checked' : '' ?>>
|
|
|
|
|
|
<span>
|
|
|
|
|
|
<b>这是「虚拟人物」</b><br>
|
|
|
|
|
|
<span class="muted small">
|
|
|
|
|
|
还没弄清真实身份时先占个位,比如起名「我的父亲」「外婆」。
|
|
|
|
|
|
他能参与亲属关系,等弄清真名再改过来即可;家谱上会标「待确认」。
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</label>
|
|
|
|
|
|
</div>
|
2026-09-30 13:24:26 +08:00
|
|
|
|
<?php endif; ?>
|
2026-09-30 08:13:07 +08:00
|
|
|
|
|
2026-09-30 00:49:53 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="btn-row">
|
|
|
|
|
|
<button class="btn" type="submit"><?= $isEdit ? '保存' : '加入名册' ?></button>
|
2026-09-30 13:24:26 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
// 取消:改自己的话回「个人设置」更顺手(那是他来的地方),
|
|
|
|
|
|
// 改别人 / 新增则回他的详情页 / 名册。
|
|
|
|
|
|
$cancelUrl = $isEdit
|
|
|
|
|
|
? ($isSelf ? url('settings/me') : url('people/show', ['id' => (int)$person['id']]))
|
|
|
|
|
|
: url('people');
|
|
|
|
|
|
?>
|
2026-10-24 04:25:02 +08:00
|
|
|
|
<?php if ($pfModal): ?>
|
|
|
|
|
|
<?php /* ⚠️ 弹框形态下「取消」必须**只关弹框**(`data-fb-add-close`),
|
|
|
|
|
|
不能跳去名册 —— 跳走就把用户刚填的一整张表扔了,
|
|
|
|
|
|
而且首页那张弹框本来就是"填一点就走"的用法。 */ ?>
|
|
|
|
|
|
<button class="btn btn-ghost" type="button"
|
|
|
|
|
|
<?= $fbAdd ? 'data-fb-add-close' : '' ?>
|
|
|
|
|
|
onclick="document.getElementById('pfAddCard').hidden = true;">取消</button>
|
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
|
<a class="btn btn-ghost" href="<?= e($cancelUrl) ?>">取消</a>
|
|
|
|
|
|
<?php endif; ?>
|
2026-09-30 13:24:26 +08:00
|
|
|
|
<?php if ($isSelf): ?>
|
|
|
|
|
|
<a class="btn btn-ghost" href="<?= e(url('people/show', ['id' => (int)$person['id']])) ?>">看我的详情页</a>
|
|
|
|
|
|
<?php endif; ?>
|
2026-09-30 00:49:53 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</form>
|
2026-10-24 04:25:02 +08:00
|
|
|
|
<?php if ($pfModal): ?>
|
|
|
|
|
|
</div><?php /* /.cal-modal-panel */ ?>
|
|
|
|
|
|
</div><?php /* /.cal-modal */ ?>
|
|
|
|
|
|
<?php endif; ?>
|
2026-10-03 19:27:14 +08:00
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
(function () {
|
|
|
|
|
|
/* ---- 头像:点图即选文件(用户 2026-10-03 第 6 条)----
|
2026-10-05 10:58:17 +08:00
|
|
|
|
⚠️ 2026-10-05 起这段**已搬到 app.js 的通用绑定**(模板上写
|
|
|
|
|
|
`data-pick-input="#avatar"` 即可)。搬走的原因:只写在"头像"这一页,
|
|
|
|
|
|
别的页面照抄同一套 DOM 却没有 JS —— 题图/封面点了没反应。
|
|
|
|
|
|
这里不再保留副本(同一件事两处实现,改一处漏一处正是那次事故的成因)。 */
|
2026-10-03 19:27:14 +08:00
|
|
|
|
|
|
|
|
|
|
/* ---- 工作经历:+/× 增删一段(用户第 4 条)----
|
|
|
|
|
|
⚠️ 模板里的行是**服务端渲染**的(首屏没有 JS 也能填、也能提交),
|
|
|
|
|
|
这里只加"再加一段 / 删掉这段"两个交互 —— 渐进增强,不是二选一。 */
|
|
|
|
|
|
var list = document.getElementById('jobList');
|
|
|
|
|
|
var addBtn = document.getElementById('jobAdd');
|
|
|
|
|
|
function bindDel(row) {
|
|
|
|
|
|
var del = row.querySelector('.job-del');
|
|
|
|
|
|
if (!del) { return; }
|
|
|
|
|
|
del.addEventListener('click', function () {
|
|
|
|
|
|
var all = list.querySelectorAll('.job-row');
|
|
|
|
|
|
if (all.length <= 1) {
|
|
|
|
|
|
// 只剩一行时"删"= 清空这一行(而不是消失),否则页面会没有输入框可填
|
|
|
|
|
|
row.querySelectorAll('input').forEach(function (i) { i.value = ''; });
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
row.remove();
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
if (list) {
|
|
|
|
|
|
Array.prototype.forEach.call(list.querySelectorAll('.job-row'), bindDel);
|
|
|
|
|
|
if (addBtn) {
|
|
|
|
|
|
addBtn.addEventListener('click', function () {
|
|
|
|
|
|
var first = list.querySelector('.job-row');
|
|
|
|
|
|
if (!first) { return; }
|
|
|
|
|
|
var row = first.cloneNode(true);
|
|
|
|
|
|
row.querySelectorAll('input').forEach(function (i) { i.value = ''; });
|
|
|
|
|
|
list.appendChild(row);
|
|
|
|
|
|
bindDel(row);
|
|
|
|
|
|
var f = row.querySelector('input');
|
|
|
|
|
|
if (f) { f.focus(); }
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-10-15 10:37:07 +08:00
|
|
|
|
|
|
|
|
|
|
/* 🔴 v51(用户第 4 条):标签的「勾选框 ↔ 文本框」双向同步。
|
|
|
|
|
|
⚠️ 文本框(name="tags")是**唯一提交源**,与服务端只读一个字段的约定一致;
|
|
|
|
|
|
勾选框只是快捷方式。判据与名册列表那个浮层**逐字一致**
|
|
|
|
|
|
(split(/[\s,,]+/) + 去掉前导 #)—— 两处口径不同的话,
|
|
|
|
|
|
"在列表页打的标签"与"在编辑页打的标签"会归一成不同的结果。
|
|
|
|
|
|
⚠️ 手打的新词没有勾选框 ⇒ 同步时要把它们**保留**(否则勾一下就把新词冲掉了)。 */
|
|
|
|
|
|
(function () {
|
|
|
|
|
|
var block = document.getElementById('ptBlock');
|
|
|
|
|
|
if (!block) { return; }
|
|
|
|
|
|
var inp = document.getElementById('pfTags');
|
|
|
|
|
|
var picks = block.querySelectorAll('.pt-pick input');
|
|
|
|
|
|
if (!inp || !picks.length) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
function syncFromPicks() {
|
|
|
|
|
|
var on = [];
|
|
|
|
|
|
Array.prototype.forEach.call(picks, function (c) { if (c.checked) { on.push(c.value); } });
|
|
|
|
|
|
var known = {};
|
|
|
|
|
|
Array.prototype.forEach.call(picks, function (c) { known[c.value] = true; });
|
|
|
|
|
|
var keep = [];
|
|
|
|
|
|
String(inp.value || '').split(/[\s,,]+/).forEach(function (w) {
|
|
|
|
|
|
w = w.replace(/^#/, '');
|
|
|
|
|
|
if (w !== '' && !known[w]) { keep.push(w); }
|
|
|
|
|
|
});
|
|
|
|
|
|
inp.value = on.concat(keep).join(' ');
|
|
|
|
|
|
}
|
|
|
|
|
|
block.addEventListener('change', function (e) {
|
|
|
|
|
|
if (e.target && e.target.closest && e.target.closest('.pt-pick')) { syncFromPicks(); }
|
|
|
|
|
|
});
|
|
|
|
|
|
})();
|
2026-10-03 19:27:14 +08:00
|
|
|
|
})();
|
|
|
|
|
|
</script>
|