v14: 观影/家谱/日程/旅程/资源/任务六模块统一,首页改 dashboard
用户 14 条需求一次交付(1-13 功能 + 14 工作方式)。 观影(1-4) - 返回文案全模块统一为「返回观影」(不再有「返回列表」「返回观影记录」三种叫法) - 观影人一律用彩色人物标签 person_chip:底色由头像主色算出来(上传时存库), 瀑布流卡片也按人显示;五处观影模板全部改用它 - 人员显示统一走 person_name()(shown → 我给他起的称呼 → 姓名) - 影院管理页与年度报告页的上下两块用 .card + .card 统一给间距(原来紧贴成一整块) 家谱(5) - 树根从「我」换成**辈分最高的祖先**:库画的是"树根的祖先链+后代+树根的兄弟姐妹", 根=我 时伯父/堂兄/嫂子/侄子一个都不画(12 人夹具只画出 8 人) - focusMap 按**代数**圈定三代(不再按步数),normalizeLinks 把子女对称挂到父母双方 —— 修掉"母亲登录看不到孩子" - 新增「看全部 / 回到我」两个按钮,放在画布外(画布整块被库接管了手势) 统一事件原语(6-9) - 旅程:TripLog 全量迁入(3 趟旅程 / 21 段行程 / 72 张照片 / 5 个人)。 复用 events(kind='trip') + trip_details + trip_nodes(计划/执行双轨保留) - 日程:每人可建日历本(自定义色)+ 共享只读/可写;观影与旅行是每人默认两本, 内容是**从各模块实时派生**的(不复制,所以改了观影日期日历立刻跟着变); 没有具体时分 = 全天;月视图参照群晖 Calendar - 资源:挂在某人名下的附属信息(标题+正文+多附件),可共享给多人并设只读/读写, 默认折叠、可搜标题与正文 - 任务:看板三列 + 两级子任务 + 评论@人 + 共享 + 循环(完成时按原截止日推下一期) - 统一附件表:四个模块的附件共用一张,下载地址不落库、一律由 media.php 现算 模块化(10-11) - App\Module 是模块的唯一来源(加一行 = 导航条/主题色/个人设置三处自动出现) - 个人设置里可勾选要显示哪些模块、拖动排序(关掉的模块**不会**被兜底补回来) - 每个模块一套主题色(家庭级),只覆盖 --brand 三兄弟,不碰纸墨底色 其他(12-13) - 新增成员表单可选所属分组(编辑表单没有:分组是"我和他的关系",只归我自己) - 首页改 dashboard:接下来的日子 / 未来七天 / 手头在做 / 往年今日。 家人卡片从首页撤走(看人去名册) 验证(全部通过) - e2e 542 条(新增 4 模块端到端 60+ 条) - 桌面几何 368 / 移动端几何 520 / 家谱 12 / 交互 97 / 老库升级 123 - SQL 列名静态校验 0 处可疑(对着真实表结构) - 反向验证 18 条新注入全部抓住 顺带修掉的既有问题 - 老库升级回填 SQL 按实际存在的列动态拼(缺列不再 1054 炸断升级) - 全新安装时 Schema::ensure 跑在"人还没建"之前 → 补建日历本三处齐备 - 窄屏导航横向溢出(模块从 4 个加到 8 个后顶栏撑破视口)
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* 行程节点表单(新增 / 编辑共用;被 show.php 循环 require)。
|
||||
*
|
||||
* 计划与执行是**双轨**:同一段行程可以先在 plan 里排一遍,走完再在 reality 里记一遍。
|
||||
* 所以表单里带一个隐藏的 category —— 加在哪一轨就进哪一轨。
|
||||
*
|
||||
* 变量(require 前设好):
|
||||
* $nfNode 被编辑的节点数组,或 null(新增)
|
||||
* $nfTripId 旅程 id(events.id)
|
||||
* $nfCategory 'plan' | 'reality'
|
||||
* $nfPeople 可选人名册(选参与人用),为空就不显示成员多选
|
||||
* $nfMembers 已选成员 id 列表
|
||||
*/
|
||||
$nfIsEdit = !empty($nfNode);
|
||||
$nfPrefix = $nfIsEdit ? 'ne' . (int)$nfNode['id'] : ('n' . ($nfCategory === 'reality' ? 'r' : 'p'));
|
||||
?>
|
||||
<form class="node-form" method="post" action="<?= e(url($nfIsEdit ? 'trips/node_update' : 'trips/node_add')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="trip_id" value="<?= (int)$nfTripId ?>">
|
||||
<input type="hidden" name="category" value="<?= e($nfCategory) ?>">
|
||||
<?php if ($nfIsEdit): ?>
|
||||
<input type="hidden" name="id" value="<?= (int)$nfNode['id'] ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="nf-grid">
|
||||
<div class="field">
|
||||
<label for="<?= e($nfPrefix) ?>-title">这一段 *</label>
|
||||
<input class="input" id="<?= e($nfPrefix) ?>-title" name="title" required
|
||||
value="<?= e($nfNode['title'] ?? '') ?>" placeholder="如:栈桥看海">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="<?= e($nfPrefix) ?>-type">类型</label>
|
||||
<select class="select" id="<?= e($nfPrefix) ?>-type" name="node_type">
|
||||
<?php foreach (\App\Trip::NODE_TYPES as $tk => $tv): ?>
|
||||
<option value="<?= e($tk) ?>"<?= ($nfNode['node_type'] ?? 'other') === $tk ? ' selected' : '' ?>>
|
||||
<?= e($tv[1] . ' ' . $tv[0]) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="<?= e($nfPrefix) ?>-place">地点</label>
|
||||
<input class="input" id="<?= e($nfPrefix) ?>-place" name="place"
|
||||
value="<?= e($nfNode['place'] ?? '') ?>" placeholder="选填">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="<?= e($nfPrefix) ?>-status">状态</label>
|
||||
<select class="select" id="<?= e($nfPrefix) ?>-status" name="status">
|
||||
<?php foreach (\App\Trip::NODE_STATUS as $sk => $sv): ?>
|
||||
<option value="<?= e($sk) ?>"<?= ($nfNode['status'] ?? 'planned') === $sk ? ' selected' : '' ?>>
|
||||
<?= e($sv) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>开始</label>
|
||||
<?php $dtName = 'starts_at'; $dtValue = $nfNode['starts_at'] ?? '';
|
||||
$dtId = $nfPrefix . '-s'; $dtSeconds = false; require __DIR__ . '/../_datetime.php'; ?>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>结束</label>
|
||||
<?php $dtName = 'ends_at'; $dtValue = $nfNode['ends_at'] ?? '';
|
||||
$dtId = $nfPrefix . '-e'; $dtSeconds = false; require __DIR__ . '/../_datetime.php'; ?>
|
||||
</div>
|
||||
<div class="field full">
|
||||
<label for="<?= e($nfPrefix) ?>-detail">记录</label>
|
||||
<textarea class="input" id="<?= e($nfPrefix) ?>-detail" name="detail" rows="2"
|
||||
placeholder="这一段发生了什么"><?= e($nfNode['detail'] ?? '') ?></textarea>
|
||||
</div>
|
||||
<?php if (!empty($nfPeople)): ?>
|
||||
<div class="field full">
|
||||
<label>这一段里有谁(不勾 = 全趟同行的人)</label>
|
||||
<div class="nf-members">
|
||||
<?php foreach ($nfPeople as $p): ?>
|
||||
<label class="check-item">
|
||||
<input type="checkbox" name="members[]" value="<?= (int)$p['id'] ?>"
|
||||
<?= in_array((int)$p['id'], $nfMembers, true) ? 'checked' : '' ?>>
|
||||
<span><?= e(person_name($p)) ?></span>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="btn-row">
|
||||
<button class="btn btn-sm" type="submit"><?= $nfIsEdit ? '保存' : '加一段' ?></button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* 记一趟旅程 / 编辑旅程(v12)。
|
||||
*
|
||||
* 字段分两组:
|
||||
* · 骨架(落在 events 上):标题 / 出发 / 回来 / 目的地 / 备注 —— 与观影同一套原语;
|
||||
* · 旅程特有(落在 trip_details 上):封面图 + 一段话小结。
|
||||
*
|
||||
* ⚠️ 同行的人用多选框(人不多,一次性列全比"搜索+联想"快);
|
||||
* 显示名一律是「我叫他什么」(person_name),提交的是 person_id。
|
||||
*/
|
||||
$isEdit = !empty($t);
|
||||
$canWrite = \App\Auth::canWrite();
|
||||
$selIds = [];
|
||||
if ($isEdit) {
|
||||
foreach ((array)($t['attendees'] ?? []) as $a) {
|
||||
$selIds[] = (int)$a['id'];
|
||||
}
|
||||
} else {
|
||||
$selIds = array_map('intval', (array)($presetAttendees ?? []));
|
||||
}
|
||||
?>
|
||||
<div class="page-head">
|
||||
<h1><?= $isEdit ? '编辑旅程' : '记一趟旅程' ?></h1>
|
||||
<div class="actions">
|
||||
<a class="btn btn-ghost"
|
||||
href="<?= e($isEdit ? url('trips/show', ['id' => (int)$t['id']]) : url('trips')) ?>">返回旅程</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-pad">
|
||||
<form method="post" enctype="multipart/form-data"
|
||||
action="<?= e(url($isEdit ? 'trips/update' : 'trips/create')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<?php if ($isEdit): ?>
|
||||
<input type="hidden" name="id" value="<?= (int)$t['id'] ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-grid">
|
||||
<div class="field full">
|
||||
<label for="t-title">这趟旅程叫什么 *</label>
|
||||
<input class="input" id="t-title" name="title" required
|
||||
value="<?= e(old('title', $t['title'] ?? '')) ?>" placeholder="如:青岛三日 · 暑假">
|
||||
<?php if (!empty($errors['title'])): ?><span class="err"><?= e($errors['title']) ?></span><?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="t-start">出发</label>
|
||||
<?php $dtName = 'starts_at'; $dtValue = $t['starts_at'] ?? '';
|
||||
$dtId = 't-start'; $dtSeconds = false; require __DIR__ . '/../_datetime.php'; ?>
|
||||
<?php if (!empty($errors['starts_at'])): ?><span class="err"><?= e($errors['starts_at']) ?></span><?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="t-end">回来</label>
|
||||
<?php $dtName = 'ends_at'; $dtValue = $t['ends_at'] ?? ''; $dtId = 't-end'; $dtSeconds = false;
|
||||
require __DIR__ . '/../_datetime.php'; ?>
|
||||
<?php if (!empty($errors['ends_at'])): ?><span class="err"><?= e($errors['ends_at']) ?></span><?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label for="t-loc">目的地</label>
|
||||
<input class="input" id="t-loc" name="location"
|
||||
value="<?= e(old('location', $t['location'] ?? '')) ?>" placeholder="如:青岛">
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label for="t-sum">一句话小结</label>
|
||||
<textarea class="input" id="t-sum" name="summary" rows="3"
|
||||
placeholder="回看时最能勾起记忆的那一句"><?= e(old('summary', $t['summary'] ?? '')) ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label for="t-note">备注</label>
|
||||
<textarea class="input" id="t-note" name="note" rows="3"><?= e(old('note', $t['note'] ?? '')) ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label>同行的人</label>
|
||||
<?php if (!$people): ?>
|
||||
<p class="empty-hint">名册里还没有人。</p>
|
||||
<?php else: ?>
|
||||
<div class="pick-list">
|
||||
<?php foreach ($people as $p): ?>
|
||||
<label class="pick-item">
|
||||
<input type="checkbox" name="attendees[]" value="<?= (int)$p['id'] ?>"
|
||||
<?= in_array((int)$p['id'], $selIds, true) ? 'checked' : '' ?>>
|
||||
<?php if (!empty($p['avatar'])): ?>
|
||||
<img class="pick-ph" src="<?= e(media_url((string)$p['avatar'])) ?>" alt="">
|
||||
<?php else: ?>
|
||||
<span class="pick-ph"></span>
|
||||
<?php endif; ?>
|
||||
<span class="pick-name"><?= e(person_name($p)) ?></span>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="field full">
|
||||
<label for="t-cover">封面图</label>
|
||||
<?php if ($isEdit && !empty($t['cover_key'])): ?>
|
||||
<div class="cover-now">
|
||||
<img src="<?= e(media_url((string)$t['cover_key'])) ?>" alt="">
|
||||
<span class="tip">不换图就不用管这里;选一张新图会替换它。</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input class="input" type="file" id="t-cover" name="cover" accept="image/*">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-row">
|
||||
<button class="btn" type="submit"><?= $isEdit ? '保存' : '记下来' ?></button>
|
||||
<a class="btn btn-ghost"
|
||||
href="<?= e($isEdit ? url('trips/show', ['id' => (int)$t['id']]) : url('trips')) ?>">取消</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* 旅程列表(v12,TripLog activities/index 迁来,但按家书的统一事件原语重写)。
|
||||
*
|
||||
* 与观影列表同一个骨架:页头 + 搜索 + 卡片列表。
|
||||
* ⚠️ 卡片上的人是「我叫他什么」(person_chip),不是姓名(用户第 3 条)。
|
||||
*/
|
||||
$canWrite = \App\Auth::canWrite();
|
||||
?>
|
||||
<div class="page-head">
|
||||
<h1>旅程</h1>
|
||||
<span class="sub">共 <?= (int)$total ?> 趟</span>
|
||||
<div class="actions">
|
||||
<?php if ($canWrite): ?>
|
||||
<a class="btn" href="<?= e(url('trips/new')) ?>">记一趟旅程</a>
|
||||
<?php else: ?>
|
||||
<span class="link-quiet">只读账号</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="search" method="get" action="index.php">
|
||||
<input type="hidden" name="r" value="trips">
|
||||
<input class="input" type="text" name="keyword" value="<?= e($keyword) ?>" placeholder="搜标题 / 目的地 / 备注">
|
||||
<button class="btn" type="submit">搜索</button>
|
||||
<?php if ($keyword !== ''): ?>
|
||||
<a class="search-clear" href="<?= e(url('trips')) ?>">清除</a>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
|
||||
<?php if (!$rows): ?>
|
||||
<div class="card card-pad empty">
|
||||
<b><?= $keyword !== '' ? '没有匹配的旅程' : '还没有旅程记录' ?></b>
|
||||
<?= $keyword !== '' ? '换个关键词试试,或清除搜索看全部。'
|
||||
: ($canWrite ? '点右上角「记一趟旅程」,把一次出行记下来。' : '家人还没有记录旅程。') ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="trip-list">
|
||||
<?php foreach ($rows as $t): ?>
|
||||
<a class="trip-card" href="<?= e(url('trips/show', ['id' => (int)$t['id']])) ?>">
|
||||
<div class="trip-cover">
|
||||
<?php if (!empty($t['cover_key'])): ?>
|
||||
<img src="<?= e(media_url((string)$t['cover_key'])) ?>" alt="">
|
||||
<?php else: ?>
|
||||
<span class="trip-cover-empty">🧳</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="trip-main">
|
||||
<h2 class="trip-title"><?= e((string)$t['title']) ?></h2>
|
||||
<div class="trip-meta">
|
||||
<span><?= e(\App\Trip::formatSpan($t['starts_at'] ?? null, $t['ends_at'] ?? null)) ?></span>
|
||||
<?php if (!empty($t['location'])): ?>
|
||||
<span>📍 <?= e((string)$t['location']) ?></span>
|
||||
<?php endif; ?>
|
||||
<span><?= (int)($t['node_count'] ?? 0) ?> 段行程</span>
|
||||
</div>
|
||||
<?php if (!empty($t['summary'])): ?>
|
||||
<p class="trip-sum"><?= e(mb_substr((string)$t['summary'], 0, 80, 'UTF-8')) ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($t['attendees'])): ?>
|
||||
<div class="trip-people">
|
||||
<?php foreach ($t['attendees'] as $a): ?>
|
||||
<?= person_chip($a) ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/**
|
||||
* 旅程详情(v12):封面 + 小结 + 同行的人 + 照片 + 行程节点(计划 / 执行双轨)。
|
||||
*
|
||||
* ⚠️ 双轨的意义:出发前排的是「打算怎么走」,走完记的是「实际怎么走的」。
|
||||
* 两轨并存才能回看"本来想去哪、后来去了哪"—— 这是 TripLog 最有价值的一点,搬过来时保留了。
|
||||
*/
|
||||
$canWrite = \App\Auth::canWrite();
|
||||
$plan = [];
|
||||
$reality = [];
|
||||
foreach ((array)($nodes ?? []) as $n) {
|
||||
if (($n['category'] ?? 'plan') === 'reality') {
|
||||
$reality[] = $n;
|
||||
} else {
|
||||
$plan[] = $n;
|
||||
}
|
||||
}
|
||||
$memberIds = array_map('intval', array_column((array)($t['attendees'] ?? []), 'id'));
|
||||
?>
|
||||
<div class="page-head">
|
||||
<h1><?= e((string)$t['title']) ?></h1>
|
||||
<span class="sub"><?= e(\App\Trip::formatSpan($t['starts_at'] ?? null, $t['ends_at'] ?? null)) ?></span>
|
||||
<div class="actions">
|
||||
<?php if ($canWrite): ?>
|
||||
<a class="btn btn-ghost" href="<?= e(url('trips/edit', ['id' => (int)$t['id']])) ?>">编辑</a>
|
||||
<form method="post" action="<?= e(url('trips/destroy')) ?>"
|
||||
onsubmit="return confirm('确定删除「<?= e((string)$t['title']) ?>」吗?照片与行程节点会一起删掉,不可恢复。')">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="id" value="<?= (int)$t['id'] ?>">
|
||||
<button class="btn btn-danger" type="submit">删除</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<a class="btn btn-ghost" href="<?= e(url('trips')) ?>">返回旅程</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-pad trip-hero">
|
||||
<div class="trip-hero-cover">
|
||||
<?php if (!empty($t['cover_key'])): ?>
|
||||
<img src="<?= e(media_url((string)$t['cover_key'])) ?>" alt="">
|
||||
<?php else: ?>
|
||||
<span class="trip-cover-empty">🧳</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="trip-hero-body">
|
||||
<?php if (!empty($t['location'])): ?>
|
||||
<p class="trip-loc">📍 <?= e((string)$t['location']) ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($t['summary'])): ?>
|
||||
<p class="info-text"><?= nl2br(e((string)$t['summary'])) ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($t['attendees'])): ?>
|
||||
<div class="viewers-list">
|
||||
<?php foreach ($t['attendees'] as $a): ?>
|
||||
<?= person_chip($a, url('people/show', ['id' => (int)$a['id']])) ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($t['note'])): ?>
|
||||
<p class="remark-text"><?= nl2br(e((string)$t['note'])) ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php /* ---- 照片 ---- */ ?>
|
||||
<div class="card card-pad">
|
||||
<h2 class="cinema-h2">照片</h2>
|
||||
<?php if (!$photos): ?>
|
||||
<p class="empty-hint">还没有照片。</p>
|
||||
<?php else: ?>
|
||||
<div class="photo-grid">
|
||||
<?php foreach ($photos as $ph): ?>
|
||||
<figure class="photo-cell">
|
||||
<a href="<?= e(media_url((string)$ph['key'])) ?>" target="_blank" rel="noopener">
|
||||
<img src="<?= e(media_url((string)$ph['key'])) ?>" alt="<?= e((string)($ph['name'] ?? '')) ?>">
|
||||
</a>
|
||||
<?php if ($canWrite): ?>
|
||||
<form method="post" action="<?= e(url('trips/photo_del')) ?>" class="photo-del">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="id" value="<?= (int)$t['id'] ?>">
|
||||
<input type="hidden" name="photo_id" value="<?= (int)$ph['id'] ?>">
|
||||
<button class="btn btn-ghost btn-sm" type="submit"
|
||||
onclick="return confirm('删掉这张照片?')">删除</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</figure>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($canWrite): ?>
|
||||
<form class="inline-form" method="post" enctype="multipart/form-data" action="<?= e(url('trips/photo_add')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="id" value="<?= (int)$t['id'] ?>">
|
||||
<input type="file" name="photo" accept="image/*" multiple required>
|
||||
<button class="btn btn-sm" type="submit">上传照片</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php /* ---- 行程节点(双轨)---- */ ?>
|
||||
<?php foreach ([['plan', '计划行程', $plan], ['reality', '实际走过', $reality]] as [$cat, $catName, $list]): ?>
|
||||
<div class="card card-pad">
|
||||
<h2 class="cinema-h2"><?= e($catName) ?> <span class="group-n"><?= count($list) ?> 段</span></h2>
|
||||
|
||||
<?php if (!$list): ?>
|
||||
<p class="empty-hint"><?= $cat === 'plan' ? '还没有排计划。' : '还没有记录实际行程。' ?></p>
|
||||
<?php else: ?>
|
||||
<ol class="node-list">
|
||||
<?php foreach ($list as $n): ?>
|
||||
<li class="node-row status-<?= e((string)$n['status']) ?>">
|
||||
<span class="node-ico" title="<?= e(\App\Trip::typeWord((string)$n['node_type'])) ?>">
|
||||
<?= e(\App\Trip::typeIcon((string)$n['node_type'])) ?>
|
||||
</span>
|
||||
<div class="node-body">
|
||||
<div class="node-head">
|
||||
<b><?= e((string)$n['title']) ?></b>
|
||||
<span class="node-badge"><?= e(\App\Trip::statusWord((string)$n['status'])) ?></span>
|
||||
<?php if (!empty($n['place'])): ?>
|
||||
<span class="node-place">📍 <?= e((string)$n['place']) ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php $span = \App\Trip::formatSpan($n['starts_at'] ?? null, $n['ends_at'] ?? null); ?>
|
||||
<?php if ($span !== '日期待补'): ?>
|
||||
<div class="node-time"><?= e($span) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($n['detail'])): ?>
|
||||
<p class="node-detail"><?= nl2br(e((string)$n['detail'])) ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($n['members'])): ?>
|
||||
<div class="trip-people">
|
||||
<?php foreach ($n['members'] as $mm): ?><?= person_chip($mm) ?><?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($n['attachs'])): ?>
|
||||
<div class="attach-row">
|
||||
<?php foreach ($n['attachs'] as $at): ?>
|
||||
<a class="attach-item" href="<?= e(media_url((string)$at['key'], ['dl' => 1])) ?>">
|
||||
<?= (int)$at['is_image'] === 1 ? '🖼' : '📄' ?> <?= e((string)($at['name'] ?: '附件')) ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($canWrite): ?>
|
||||
<div class="node-ops">
|
||||
<details class="node-edit">
|
||||
<summary class="link-quiet">编辑</summary>
|
||||
<?php
|
||||
$nfNode = $n; $nfTripId = (int)$t['id']; $nfCategory = $cat;
|
||||
$nfPeople = $people ?? [];
|
||||
$nfMembers = array_map('intval', array_column((array)($n['members'] ?? []), 'id'));
|
||||
require __DIR__ . '/_node_form.php';
|
||||
?>
|
||||
</details>
|
||||
<form method="post" action="<?= e(url('trips/node_del')) ?>"
|
||||
onsubmit="return confirm('删掉这一段?')">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="id" value="<?= (int)$n['id'] ?>">
|
||||
<input type="hidden" name="trip_id" value="<?= (int)$t['id'] ?>">
|
||||
<button class="btn btn-ghost btn-sm" type="submit">删除</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($canWrite): ?>
|
||||
<details class="node-add">
|
||||
<summary class="link-quiet">+ 加一段<?= e($catName) ?></summary>
|
||||
<?php
|
||||
$nfNode = null; $nfTripId = (int)$t['id']; $nfCategory = $cat;
|
||||
$nfPeople = $people ?? []; $nfMembers = $memberIds;
|
||||
require __DIR__ . '/_node_form.php';
|
||||
?>
|
||||
</details>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
Reference in New Issue
Block a user