2026-09-22 22:03:08 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 节点详情:基础信息 + 参与人 + 花销 + 讨论
|
|
|
|
|
|
* 一个节点一页,把挂在这个节点上的所有记录集中起来
|
|
|
|
|
|
*/
|
2026-09-22 23:09:37 +08:00
|
|
|
|
use App\Attachments;
|
2026-09-22 22:03:08 +08:00
|
|
|
|
use App\Comments;
|
|
|
|
|
|
|
|
|
|
|
|
$statusLabels = [
|
|
|
|
|
|
'planned' => '待执行',
|
|
|
|
|
|
'ongoing' => '进行中',
|
|
|
|
|
|
'completed' => '已完成',
|
|
|
|
|
|
'cancelled' => '已取消',
|
|
|
|
|
|
];
|
|
|
|
|
|
$st = (string)($node['status'] ?? 'planned');
|
|
|
|
|
|
if (!isset($statusLabels[$st])) $st = 'planned';
|
|
|
|
|
|
|
|
|
|
|
|
$sLoc = json_decode_field($node['start_location'] ?? null);
|
|
|
|
|
|
$eLoc = json_decode_field($node['end_location'] ?? null);
|
|
|
|
|
|
|
2026-09-22 23:09:37 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 交通只记一个号码(航班号 / 车次 / 班次)——
|
|
|
|
|
|
* 航班号本身就隐含航空公司,座位号对多人同行又没法记,所以都不收。
|
|
|
|
|
|
*/
|
|
|
|
|
|
$tripFieldLabels = [
|
|
|
|
|
|
'plane' => '航班号',
|
|
|
|
|
|
'train' => '车次',
|
|
|
|
|
|
'bus' => '班次',
|
|
|
|
|
|
'subway' => '线路',
|
|
|
|
|
|
'ship' => '航次',
|
|
|
|
|
|
'taxi' => '备注',
|
|
|
|
|
|
];
|
|
|
|
|
|
$tripLabel = $tripFieldLabels[(string)($node['travel_mode_type'] ?? '')] ?? '车次 / 班次';
|
|
|
|
|
|
|
2026-09-22 22:03:08 +08:00
|
|
|
|
$transportParts = [];
|
2026-09-22 23:09:37 +08:00
|
|
|
|
if (!empty($node['trip_number'])) {
|
|
|
|
|
|
$transportParts[] = $tripLabel . ' ' . $node['trip_number'];
|
2026-09-22 22:03:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$durationText = '';
|
|
|
|
|
|
if (!empty($node['duration_minutes'])) {
|
|
|
|
|
|
$mins = (int)$node['duration_minutes'];
|
|
|
|
|
|
$durationText = $mins >= 60 ? intdiv($mins, 60) . ' 小时 ' . ($mins % 60) . ' 分' : $mins . ' 分钟';
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
|
|
<div class="page-header">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<h1><?= e(($node['node_type_icon'] ?? '') . ' ' . ($node['title'] ?: '(无标题节点)')) ?></h1>
|
|
|
|
|
|
<p class="muted">
|
|
|
|
|
|
<a href="<?= url('activities/show', ['id' => $node['activity_id']]) ?>"><?= e($node['activity_title']) ?></a>
|
|
|
|
|
|
· <?= $node['node_category'] === 'plan' ? '计划节点' : '执行节点' ?>
|
|
|
|
|
|
· <span class="status-tag status-<?= e($st) ?>"><?= e($statusLabels[$st]) ?></span>
|
|
|
|
|
|
<?php if ($node['node_category'] === 'reality' && !empty($node['original_plan_node_id'])): ?>
|
|
|
|
|
|
· <span class="tag-default">由计划节点生成</span>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="actions" style="display:flex; gap:8px; flex-wrap:wrap;">
|
|
|
|
|
|
<a href="<?= url('nodes/edit', ['id' => $node['id']]) ?>" class="btn">编辑节点</a>
|
2026-09-22 23:09:37 +08:00
|
|
|
|
<a href="<?= url('attachments/node', ['id' => $node['id']]) ?>" class="btn">📷 照片 (<?= (int)$attachmentCount ?>)</a>
|
2026-09-22 22:03:08 +08:00
|
|
|
|
<a href="<?= url('activities/show', ['id' => $node['activity_id']]) ?>" class="btn">返回活动</a>
|
|
|
|
|
|
<form method="post" action="<?= url('nodes/destroy') ?>" style="display:inline;"
|
|
|
|
|
|
onsubmit="return confirm('确定删除这个节点?它的附件、参与记录、花销和讨论都会一并删除。');">
|
|
|
|
|
|
<input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">
|
|
|
|
|
|
<input type="hidden" name="id" value="<?= (int)$node['id'] ?>">
|
|
|
|
|
|
<button type="submit" class="btn btn-danger">删除节点</button>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="detail-grid">
|
|
|
|
|
|
<div class="detail-item">
|
|
|
|
|
|
<span class="detail-label">时间</span>
|
|
|
|
|
|
<span class="detail-value">
|
|
|
|
|
|
<?= date('Y-m-d H:i', strtotime((string)$node['start_time'])) ?>
|
|
|
|
|
|
→
|
|
|
|
|
|
<?= date('Y-m-d H:i', strtotime((string)$node['end_time'])) ?>
|
|
|
|
|
|
<?php if ($durationText !== ''): ?>
|
|
|
|
|
|
<span class="muted">(<?= e($durationText) ?>)</span>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="detail-item">
|
|
|
|
|
|
<span class="detail-label">类型</span>
|
|
|
|
|
|
<span class="detail-value"><?= e($node['node_type_name'] ?? '未分类') ?></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php if (!empty($node['travel_mode_label'])): ?>
|
|
|
|
|
|
<div class="detail-item">
|
|
|
|
|
|
<span class="detail-label">出行方式</span>
|
|
|
|
|
|
<span class="detail-value"><?= e($node['travel_mode_label']) ?></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if (!empty($transportParts)): ?>
|
|
|
|
|
|
<div class="detail-item">
|
2026-09-22 23:09:37 +08:00
|
|
|
|
<span class="detail-label">交通</span>
|
2026-09-22 22:03:08 +08:00
|
|
|
|
<span class="detail-value"><?= e(implode(' · ', $transportParts)) ?></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if (!empty($sLoc['name']) || !empty($sLoc['address'])): ?>
|
|
|
|
|
|
<div class="detail-item">
|
|
|
|
|
|
<span class="detail-label">起点</span>
|
|
|
|
|
|
<span class="detail-value">
|
|
|
|
|
|
📍 <?= e($sLoc['name'] ?? '') ?>
|
|
|
|
|
|
<?php if (!empty($sLoc['address'])): ?>
|
|
|
|
|
|
<span class="muted"><?= e($sLoc['address']) ?></span>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if (!empty($eLoc['name']) || !empty($eLoc['address'])): ?>
|
|
|
|
|
|
<div class="detail-item">
|
|
|
|
|
|
<span class="detail-label">终点</span>
|
|
|
|
|
|
<span class="detail-value">
|
|
|
|
|
|
📍 <?= e($eLoc['name'] ?? '') ?>
|
|
|
|
|
|
<?php if (!empty($eLoc['address'])): ?>
|
|
|
|
|
|
<span class="muted"><?= e($eLoc['address']) ?></span>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if (!empty($node['description'])): ?>
|
|
|
|
|
|
<div class="detail-item detail-item-wide">
|
|
|
|
|
|
<span class="detail-label">描述</span>
|
|
|
|
|
|
<span class="detail-value"><?= nl2br(e($node['description'])) ?></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if ($st === 'cancelled' && !empty($node['cancel_reason'])): ?>
|
|
|
|
|
|
<div class="detail-item detail-item-wide">
|
|
|
|
|
|
<span class="detail-label">取消原因</span>
|
|
|
|
|
|
<span class="detail-value node-cancel-reason"><?= e($node['cancel_reason']) ?></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-09-22 23:09:37 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
/* 照片墙:地址一律走 media/show 代理,页面里不出现存储后端的真实地址 */
|
|
|
|
|
|
$photoRows = [];
|
|
|
|
|
|
$otherCount = 0;
|
|
|
|
|
|
foreach (($attachments ?? []) as $attRow) {
|
|
|
|
|
|
if (Attachments::isImageRow($attRow)) {
|
|
|
|
|
|
$photoRows[] = $attRow;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$otherCount++;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
$showPhotos = array_slice($photoRows, 0, 12);
|
|
|
|
|
|
?>
|
|
|
|
|
|
<?php if (!empty($attachments)): ?>
|
|
|
|
|
|
<h2 class="section-title" id="photos">照片与附件(<?= count($attachments) ?>)</h2>
|
|
|
|
|
|
|
|
|
|
|
|
<?php if (!empty($showPhotos)): ?>
|
|
|
|
|
|
<div class="photo-grid photo-grid-sm">
|
|
|
|
|
|
<?php foreach ($showPhotos as $attRow): ?>
|
|
|
|
|
|
<a class="photo-card" href="<?= e(media_att((int)$attRow['id'])) ?>"
|
|
|
|
|
|
target="_blank" rel="noopener" title="<?= e($attRow['file_name']) ?>">
|
|
|
|
|
|
<img src="<?= e(media_att((int)$attRow['id'])) ?>" alt="" loading="lazy">
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
<?php if (count($photoRows) > count($showPhotos)): ?>
|
|
|
|
|
|
<a class="photo-more" href="<?= url('attachments/node', ['id' => (int)$node['id']]) ?>#photos">
|
|
|
|
|
|
+<?= count($photoRows) - count($showPhotos) ?><span>张</span>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="photo-bar">
|
|
|
|
|
|
<a class="btn btn-sm" href="<?= url('attachments/node', ['id' => (int)$node['id']]) ?>">
|
|
|
|
|
|
📷 管理照片(<?= count($attachments) ?>)
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<?php if ($otherCount > 0): ?>
|
|
|
|
|
|
<span class="muted">另有 <?= (int)$otherCount ?> 个非图片附件</span>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
2026-09-22 22:03:08 +08:00
|
|
|
|
<?php require __DIR__ . '/_members.php'; ?>
|
|
|
|
|
|
|
|
|
|
|
|
<?php require __DIR__ . '/_expenses.php'; ?>
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
$commentTargetType = Comments::TARGET_NODE;
|
|
|
|
|
|
$commentTargetId = (int)$node['id'];
|
|
|
|
|
|
require dirname(__DIR__) . '/comments/_block.php';
|
|
|
|
|
|
?>
|